Commit Graph
328 Commits
Author SHA1 Message Date
David Sangrey 2041b3d3d3 [Minor] Update Type Hints and Alias Usages 2025-12-01 22:04:28 -05:00
David Sangrey 5f70a8d7a4 [Minor] Replace Dep'd Functions, Minor Type Hinting 2025-11-09 13:41:07 -05:00
David Sangrey 34e73dcfb2 Updated Linter Suppression for Existing 2025-10-16 16:34:16 -04:00
David Sangrey f63774ebc6 [#1318] Update Lagging Message 2025-05-03 20:12:10 -04:00
David Sangrey 4c334835f2 [Minor] Simplify if-else statements 2025-04-11 19:57:18 -04:00
David Sangrey f8b7a8b919 [2114] Cleanup Initial Commit
Some of these are already paths.
2024-06-10 17:49:13 -04:00
David Sangrey fe8818d187 [2114] Apply PathLib Handover 2024-06-10 17:21:06 -04:00
David Sangrey 3209b4e1fb [2251] ResPath Update 2024-06-06 17:25:51 -04:00
David Sangrey d4960efa8c [Lang] Update Translations
Also corrects fleetcarrier to proper Fleet Carrier
2024-06-03 16:44:18 -04:00
David Sangrey 080d9f98f2 [1812] Handover Translations 2024-04-22 17:33:28 -04:00
David Sangrey 0b90ca7708 [Minor] More Type Hints 2024-01-05 15:39:26 -05:00
David Sangrey 7cac00b2e8 [635] Remove Ordered Dict 2024-01-03 23:55:12 -05:00
Phoebe 17e740d3ee [1801] Check for files at output generation
Adds a check to see if the FDevID files exist to the output file generation process. If they don't generate a warning log entry and continue without them.
2023-12-16 02:10:55 +01:00
David Sangrey 95f2ea40b6 [#1843] Fix URL Parameter Bug
Replaces vague space with properly encoded %20. This SHOULD solve the issue, but I can't replicate the original issue.
2023-12-12 21:28:56 -05:00
David Sangrey f30fb56f6e [2051] Re-add missing context
It's not a refactor if I don't accidentally nuke a lang comment
2023-11-30 22:05:59 -05:00
David Sangrey cb2a18025c [2051] First Pass Remaining Files 2023-11-30 21:30:18 -05:00
David Sangrey 3b679c1556 #2048 Validate RegKeys, Auth Flow 2023-08-06 17:40:04 -04:00
Athanasius 468a9effe5 companion.py: Minor typing cleanup 2022-12-30 16:47:02 +00:00
Athanasius 0fe5e17b65 CAPI: Fix dump_capi_data() for /fleetcarrier
Still produces the system/station:

    `HIP 10792.Crimson Exchange.2022-12-30T16.22.39.json`

But now also the FC:

    `FleetCarrier.X3F-N5Z.2022-12-30T16.24.01.json`
2022-12-30 16:25:25 +00:00
aussig e22fa7c23b Store cmdr name at request time in CAPIData instead of passing into EDMCCAPIRequest and EDMCCAPIResponse 2022-12-24 09:32:45 +00:00
aussig 41962663d8 Merge branch 'develop' into feature/847/capi-fleetcarrier 2022-12-24 08:21:18 +00:00
Athanasius 7fe86c5862 companion.py: Minor typing fixes 2022-12-23 14:47:15 +00:00
aussig 7e726e606a Store original request cmdr name in 'request_cmdr' in CAPIData 2022-12-23 12:47:35 +00:00
aussig 3e295db061 Typing of return values from killswitch.check_killswitch() 2022-12-22 17:39:20 +00:00
aussig 9e17c46b25 Implement suggestions from PR #1773. 2022-12-22 16:21:42 +00:00
aussig cb2a6b6995 Merge branch 'develop' into feature/847/capi-fleetcarrier 2022-12-22 15:32:17 +00:00
Athanasius 292b449cf6 Fix up companion.Session.close() refactor
* When PyCharm made a mess I accidentally undid two renames in
  EDMarketConnector.py...
* ... but one of those actually *does* need to only close the session.  So
  made a new Session.close() that performs only the closing, with
  Session.reinit_session() now utilising that.
2022-12-22 09:15:16 +00:00
aussig 6ebdea1a6c Fleetcarrier CAPI now triggered by certain carrier journal events, and throttled on its own cooldown (15 mins) 2022-12-21 23:00:36 +00:00
aussig eedf4febdf Initial implementation of CAPI /fleetcarrier endpoint 2022-12-21 23:00:35 +00:00
Athanasius d6c74c269d companion: Cite endpoint in capi_single_query() logging 2022-12-21 13:41:07 +00:00
Athanasius df384c73a1 companion: Refactor Session.close() to Session.reinit_session()
This way it's *never* `None`, and the type can be tightend up as well.
2022-12-21 13:36:39 +00:00
Athanasius e65a1e6afa companion: Have Session.close() actually open a new one by default
Both current callers to this are in code paths where it is expected that
Session.requests_session will be valid later.  Rather than assign a new
session at the call sites just make this by default open a new session.
2022-12-21 13:27:53 +00:00
Athanasius 5070c3686f companion.Session: Don't double-initaliase requests_session
I forgot to remove the `requests.Session()` call in `start_frontier_auth()`.
And upon removing that we need a `None` trap to make mypy happy.
2022-12-16 15:40:48 +00:00
Athanasius 729016cf38 companion.py: Fix exception type & initialise a requests_session
* Use `Exception` not `BaseException` for `EDMCCAPIFailedRequest.exception`.
* Initialise Auth.request_session in its `__init__()`.  This *should* fix
  #1727 - as there'll then be no way for a `Session` to have methods invoked
  without this set up.
2022-12-16 15:35:59 +00:00
Athanasius ba68397b3f CAPI killswitches: endpoint killswitches & eddn export ones too
* Added `capi.request.<endpoint>` killswitches at appropriate call points.
* Added `eddn.capi_export.<type>` killswitches.  This allows for killing
  just the EDDN export of such CAPI-derived data, without stopping the actual
  queries, as other plugins/functionality might still have harmless use of
  the data.
* PLUGINS.md: Actually describe the contents of `data` passed to plugins, and
  point out it might not always contain market or shipyard data.  This is
  not only because of the new killswitches, but could already have happened
  if the station/port docked at didn't have the services.
* Some misc typing cleanups.
2022-12-16 15:06:01 +00:00
Athanasius f789ad6e24 companion: A start on adding CAPI killswitches 2022-12-16 13:22:30 +00:00
Athanasius ccdc187efa CAPI: Remove 'safeties' preventing Legacy CAPI queries 2022-12-08 11:58:34 +00:00
Athanasius b754ef8700 companion: mypy fixups & misc
* Some `Optiona[str]` required.
* Remove old pre-CAPIData comment about adding it
2022-12-08 11:06:43 +00:00
Athanasius 9fdf768ce3 CAPI: Enable selection of SERVER_LEGACY in capi_host_for_galaxy()
Also adds DEBUG logging for the selection.
2022-12-08 11:02:39 +00:00
Athanasius b40d3b889f CAPI: Use CAPI-Live-<endpoint> game_version for market & shipyard 2022-12-01 16:42:05 +00:00
Athanasius 4b31b67042 CAPI: Only perform queries for Live galaxy.
* This is *temporary* pending properly implementing utilising the Legacy
  CAPI host.
* Check in the EDMarketConnector.EDApp.capi_request_data() function *and*
  also in some companion.session functions.  But not absolutely all possible
  entry points because we'll be undoing it when we implement Legacy support.

This *is* sufficient for the current core code entry points.  If any plugin
is invoking its own CAPI requests, well it shouldn't be.
2022-12-01 16:42:04 +00:00
Athanasius bcabd97f4c FDevIDs: Switch code to using FDevIDs/ files 2021-12-17 11:08:14 +00:00
Athanasius 4ab6d62926 user_agent: Set this once in config.py and use it everywhere
* Also flake8/mypy pass on timeout_session.py
2021-11-29 18:04:56 +00:00
Athanasius b0b1ed589b CAPI: Don't blindly dump r(equest.Response) on failure
Also explicitly logs the exception now.
2021-11-10 10:07:37 +00:00
Athanasius 6bec46be4e CAPI: Implement a one-shot override of the Access Token
This allows you to force use of an expired token so as to test the code
paths for that without waiting up to 4 hours for the current one to
expire.

NB: The Access Token is *only* stored in the headers of the `requests`
object.
2021-11-06 10:41:33 +00:00
Athanasius 7a52ddd278 CAPI: Add retry of request after refreshing Access Token 2021-11-05 17:57:35 +00:00
Athanasius 8e32ecd216 CAPI: Actually try to use Refresh Token if CAPI says unauthorized
The refactor for threaded CAPI worker has inadvertently caused us to
always try *full* re-auth when the CAPI signals the Access Token is
expired.
2021-11-05 17:52:50 +00:00
Athanasius 1f7b0b7c0d companion.py: Fix isort order complaint 2021-10-17 14:02:10 +01:00
A_D 5b68aad184 Remove protocol.protocolhandler singleton auto-init
In general, doing things like this on import is bad, but this was
changed specifically to remove a bug that causes
--force-localserver-auth to do nothing.

That is caused because while we were careful not to import protocol
until after we were done doing arg things, we did not check to make sure
something else didn't. Companion imports protocol, which thus always
instantiates WindowsProtocolHandler before we can modify some config
state to indicate that we want LinuxProtocolHandler.
2021-09-24 16:39:30 +02:00
Athanasius 796bb1f863 CAPI: Remove unuses Session.query/profile()
* Session.profile() was unused (used to be called from stats.py, but
  that uses cached data now).
* Session.query() was unused, other than by itself.  Normal calls will
  currently be via companion.Session.station().  Future CAPI queries
  like `/fleetcarrier` might add their own companion.Session function.
* And in doing so get --capi-pretend-down working again.
* Small tweak to EDMarketConnector to not throw extra exception if there
  was a CAPI query exception.
2021-08-31 14:08:15 +01:00