1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 01:22:19 +03:00

211 Commits

Author SHA1 Message Date
b30b25216b
companion.py: change raising exception when pretending CAPI down 2021-08-16 15:24:01 +03:00
2e90a1bbe9
Remove raise CAPI pretend down on auth requests, add endpoint for which CAPI pretend down raising 2021-08-16 14:40:46 +03:00
92b131f81a
companion.py: reorder conf_module import for isort 2021-08-13 23:07:18 +03:00
d068dc7620
Merge branch 'develop' into enhancement/1096/CAPI-pretend-down-CL-arg 2021-08-13 23:04:42 +03:00
01bd637730
Add CL arg --capi-pretend-down in order to pretend that CAPI is down 2021-08-13 21:47:47 +03:00
Athanasius
7149f7e792
companion: Change trace_if 'capi-query' to 'capi.query' 2021-08-13 15:20:42 +01:00
Athanasius
df84b8aa64
companion: Change logger.trace to logger.trace_if
This adds only 'capi-query' to --trace-on possibilities.
2021-08-13 15:14:01 +01:00
Athanasius
bb54bc25b4
companion: Clean up some flake8 and mypy gripes 2021-08-07 14:08:16 +01:00
inb
f1ef557dee re #1198 work around +size suffixes in CAPI responses
Co-authored-by: A_D <A-UNDERSCORE-D@users.noreply.github.com>
2021-08-06 20:59:04 +01:00
Athanasius
713b6b753d CAPI: Catch where we're CAPI-docked, but monitor.station is None
Docked at an EDO settlement means CAPI says we are, but we've forgotten
monitor.station because there's not enough Journal information and too
many corner cases to be *sure* of re-using old data.
2021-06-13 20:09:00 +01:00
Athanasius
88b56b6913 CAPI: Add logger.warning() for *why* we raise ServerLagging 2021-06-13 19:43:14 +01:00
Athanasius
83f3f09882 companion: Tweak LANG comment for 'CAPI disagreed with Journal game location'
'Journal location' is ambiguous, potentially referring to where on-disk
the files are.
2021-06-13 14:59:35 +01:00
Athanasius
e736f30358
Merge pull request #1158 from EDCD/enhancement/l10n-add-missing-LANG-comments
Add all missing LANG comments
2021-06-13 13:48:34 +01:00
Athanasius
b09a102d87 companion.py: Final LANG comments added. 2021-06-13 12:51:48 +01:00
Athanasius
f449e85c0b CAPI: 'SKUError' exception was never used - removed
Also LANG comments added.
2021-06-13 12:42:50 +01:00
Athanasius
8a756fee39
Merge pull request #1167 from A-UNDERSCORE-D/fix/890/forget-frontier-auth
Added CL arg to forget all frontier tokens
2021-06-13 12:04:32 +01:00
Athanasius
799b5b7666 CAPI: Change confusing post-login again log message 2021-06-12 19:24:26 +01:00
A_D
284064d6ed
Added CL arg to forget all frontier tokens
This is obviously quite annoying but should provide a magic fix to any
user with weird auth trouble (such as those seen by
EDCD/EDMarketConnector#1166 )

Closes EDCD/EDMarketConnector#890
2021-06-12 16:38:25 +02:00
A_D
09a0b70891
Switched logs to warning 2021-06-07 19:07:24 +02:00
A_D
a79cde641e
Removed unused import 2021-06-07 19:06:30 +02:00
A_D
c4e9767974
Don't spam a stacktrace on requests.ConnectionError
ConnectionErrors are expected and not something we can fix. The
exception handler that was catching these previously is a catchall
intended to stop EDMC as a whole from crashing from something
unexpected.

Closes #1082
2021-06-07 19:06:27 +02:00
A_D
fe90f1f0b3
Cleaned up imports, removed incase imports
closes EDCD/EDMarketConnector#569
2021-05-28 14:46:51 +02:00
Athanasius
72242764fd Suits: Set edmcName on CAPI data for all suits. 2021-05-27 17:33:56 +01:00
Athanasius
c48fe4cdfb Suits: Set edmcName in CurrentSuit from CAPI, and ensure displayed 2021-05-27 17:28:52 +01:00
Athanasius
431d83b5ca companion: Tweak 'server returned an error' message & translate 2021-05-21 14:32:26 +01:00
Athanasius
89c486401e Translations: companion.py "Frontier CAPI query failure" 2021-05-21 14:25:51 +01:00
Athanasius
9cfa60ae26 CAPI: Make user-visible error text more obvious
Mostly call out this is 'Frontier CAPI' related.
2021-05-21 14:23:35 +01:00
Athanasius
1bc1a4f1b9 CAPI: Changed "CAPI down" message to be specific
The old "Error: Frontier server is down" can easily be confused as "game
servers are down".  The new version calls out the CAPI specifically.

Closes #585
2021-05-17 12:10:08 +01:00
Athanasius
bd1b86d3a3 Suits/Loadouts: Always convert to dict form for simpler downstream code. 2021-04-29 11:30:55 +01:00
A_D
0913cff472
fixed import order 2021-04-16 17:46:22 +02:00
A_D
a3e0823701
Added utility sparse list index function
Frontier sometimes uses dicts as sparse lists, this should work to index
them either way. Doctests included do pass.
2021-04-16 17:36:53 +02:00
Athanasius
e4f7c998cd companion: Improve station() checks and documentation
* Expand on the docstring to point out extra queries might be made.
* Add checks for lastStarport and then name within that being properly
  present and set.
2021-04-15 19:39:40 +01:00
Athanasius
74a3bea619 CAPI: catch lastStarport->services being an empty list (not dict)o
This is caused, at least on Odyssey Alpha Phase 3, 4.0.0.20, by:

1. Jump to a new system.
2. Don't dock yet.
3. Cause CAPI pull with 'Update' button.
4. The PTS CAPI server is returning:

  "lastStarport": {
    "faction": "",
    "id": 3221604096,
    "minorfaction": "",
    "name": "",
    "services": []
  },

So actually we need to decide it's not sane at all.
2021-04-15 18:16:41 +01:00
Athanasius
53f8209820 Move AppWindow.dump_capi_data() to be in companion.Session instead
It's writing CAPI data to a file, so it should be in companion.py.

Also:

* Use companion.CAPIData as type, not a Mapping.
2021-04-15 16:56:03 +01:00
Athanasius
2246278286 Odyssey Suits: Store available data from CAPI.
I've gone with 'None' for when there's no data, rather than {}.  That
makes for simpler checks on if there is data (a dict.get('foo') only
checks for that, not the dict structure otherwise).

If no 'suit' in the data we assume no Odyssey, but otherwise plough on
with dict.get() statements as they'll default to None if it's not
present.

*Users* of this monitor.state[] extra data get to choose what to do if
some data is present but not other.
2021-04-13 12:12:51 +01:00
Athanasius
99d90b52b1 translations: Re-order as per l10n.py output & some added
* Generic 'Error'.
* Strings for Access Token customer_id != FID.
* Other strings in companion.py now translating.
* Missing colon on Plugins string.
2021-04-12 14:58:03 +01:00
Athanasius
ffc8d2fcb8 Add comment about assuming FID always starts 'F'. 2021-04-12 12:52:05 +01:00
Athanasius
0575c3ff43 companion: Don't over-write all CredentialsError with generic one 2021-04-12 12:38:23 +01:00
Athanasius
ca08339dfe companion: /decode access token and check customer_id matches FID 2021-04-12 12:37:17 +01:00
Athanasius
5c7aa4dfa9 companion: commented-out example of requests/http debug logging 2021-04-12 12:03:11 +01:00
Athanasius
2686500d65 companion: Split Frontier Auth URL string over lines
This way a change to one part is an easier to read diff.
2021-04-12 11:05:11 +01:00
Athanasius
e34deb5388 companion.py: Fix lints
mypy is still a PITA with `Optional[<type>]` thinking the variable is
`None` at points and refusing to believe it has methods the non-None
type has.
2021-04-12 08:31:48 +01:00
Athanasius
bc6557dd9c Quieten various TRACE log output.
* A lot of this is commented out.  It might be useful in the future, but
  is just too noisy for now.
* Changed the protocol webserver to info, as it is.
* Left the EDSM 'not 1XX, 2XX or 5XX' in as it's a warning, so 'pass's
  on the conditional bodies that would be empty now trace's are
  commented.
2021-04-12 08:31:47 +01:00
Athanasius
ad8c63c64c Move util_ships.py ship_map to data.py ship_name_map
Also refactors data.py to edmc_data.py as I'm having weird issues with
PyCharm debugger not starting, and this seems to be to do with module
name clashes.
2021-04-12 08:31:47 +01:00
Athanasius
5db62e48a3 Move companion.py category_map into data.py 2021-04-12 08:31:46 +01:00
Athanasius
b70efab345 companion.py: Another s/on_foot/OnFoot/ for monitor.state 2021-04-12 08:30:51 +01:00
Athanasius
f45f817fa2 EDDB plugin now setting Station name correctly on_foot
* monitor.on_foot is now monitor.state['on_foot'] as plugins need to
  access it.
* EDDB:journal_entry() now stores that in this.on_foot to check later.
* this.on_foot checked in cmdr_data() to actually set station name from
  that data if needs be.  This avoids setting it to STATION_UNDOCKED if
  data['commander']['docked'] is False, when we're on_foot.
2021-04-12 08:30:51 +01:00
Athanasius
567cfdb9ca Will now send data to EDDN when on-foot in-station.
NB: No shipyard in tests because data['ships']['shipyard_list'] is an
empty list.  This might be the bug not having been fixed, or the station
might genuinely have no ships for sale.  We have no way to check in
Odyssey Alpha Phase 1.
2021-04-12 08:30:51 +01:00
Athanasius
a09512f3b3 Mostly refactoring companion.ship_file_name() into util_ships.py
* Also prevent "You're not docked at a station!" for on_foot.
2021-04-12 08:30:51 +01:00
Athanasius
2f9789afdd Update all code to use config.appversion() as a function
This *also* caught some instances where appversion_nobuild should
already have been used, so those were both changed and updated to a
function call.
2021-04-01 14:45:52 +01:00