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.
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`
* 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.
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.
* 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.
* 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.
* 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.
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.
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.
* 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.
NB: We can't use a generator here to make a python object of the data,
to then use json.dumps() on because the raw_data is a *string* (decoded
from what we received from the CAPI service), and thus it will get
encoded as such, i.e.
"raw_data": "{\"id\":322...
when we want:
"raw_data": {"id":322...
We do not want to json.loads() that string only to then json.dumps() it
because the whole point is that this is the **raw** data to help
diagnose any issues with the CAPI service/data. Such a conversion and
back could either throw an exception we don't want here (because we want
the raw data) or possibly distort things from what was actually
received.