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

4012 Commits

Author SHA1 Message Date
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
e07affe905
Merge pull request #1282 from EDCD/enhancement/1281/CL-eddn-target
Add support for --eddn-url CL arg
2021-09-24 11:28:45 +01:00
Athanasius
f9875b5b9a
EDDN: Make use of new CL arg to use custom upload URL
This also entailed slightly reworking the way the EDDN code uses this
URL.  It was very generalised, so as to allow for the debug "just send
and log locally" code, but as the only URL is the 'upload' one much of
that seemed un-necessary.

So that code has been simplified.
2021-09-24 10:59:15 +01:00
Athanasius
e6e1cbd221
CL args: Group them in-code 2021-09-24 10:34:42 +01:00
Athanasius
14ca94c600
Merge pull request #1279 from EDCD/dependabot/pip/develop/types-requests-2.25.8
build(deps-dev): bump types-requests from 2.25.6 to 2.25.8
2021-09-23 19:45:25 +01:00
Athanasius
b83ad3e429
Merge pull request #1273 from EDCD/dependabot/pip/develop/py2exe-0.10.4.1
build(deps-dev): bump py2exe from 0.10.4.0 to 0.10.4.1
2021-09-23 19:45:13 +01:00
dependabot[bot]
8c0ea89058
build(deps-dev): bump types-requests from 2.25.6 to 2.25.8
Bumps [types-requests](https://github.com/python/typeshed) from 2.25.6 to 2.25.8.
- [Release notes](https://github.com/python/typeshed/releases)
- [Commits](https://github.com/python/typeshed/commits)

---
updated-dependencies:
- dependency-name: types-requests
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-22 17:03:29 +00:00
Forest
cbcf5f6d44
Log git's absence at the INFO level, not ERROR
The ERROR log level is needlessly high for complaining about git not being installed, especially when we're running from an extracted source archive rather than a repo. Let's keep things calm and avoid polluting desktop session logs. The INFO log level is plenty.
2021-09-18 09:14:11 +01:00
dependabot[bot]
8180b34798
build(deps-dev): bump py2exe from 0.10.4.0 to 0.10.4.1
Bumps [py2exe](https://github.com/py2exe/py2exe) from 0.10.4.0 to 0.10.4.1.
- [Release notes](https://github.com/py2exe/py2exe/releases)
- [Changelog](https://github.com/py2exe/py2exe/blob/master/ChangeLog)
- [Commits](https://github.com/py2exe/py2exe/compare/v0.10.4.0...v0.10.4.1)

---
updated-dependencies:
- dependency-name: py2exe
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-08 17:03:19 +00:00
Athanasius
0e4e31d733
EDMarketConnector: Correct back to dashboard.start()
Bad PyCharm refactor/rename in 81b5d015fdeecfcf2236a61c433d4c2dac929668
2021-09-02 19:41:37 +01:00
Athanasius
ce35b529f4
Merge pull request #1270 from EDCD/dependabot/pip/develop/pytest-6.2.5
build(deps-dev): bump pytest from 6.2.4 to 6.2.5
2021-08-31 18:09:21 +01:00
dependabot[bot]
5898959228
build(deps-dev): bump pytest from 6.2.4 to 6.2.5
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.4 to 6.2.5.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.4...6.2.5)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 17:03:50 +00:00
Athanasius
018ee49a0d
Fix logic for 'Update' button visual state wrt CQC
This was wrong since 291fbf2908e0f7419769a7727ee0a79cf58a9342 due to the
check saying "only active if in CQC", when it needed to be "only active
NOT in CQC, along with these other conditions".
2021-08-31 15:03:41 +01:00
Athanasius
4482da007f
Merge pull request #1261 from EDCD/enhancement/945/CAPI-threaded-queries
Change all CAPI queries over to a queue/thread model
2021-08-31 14:27:48 +01: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
Athanasius
60379892ee
companion: DRY try/except of CAPI queries 2021-08-31 13:07:00 +01:00
Athanasius
af50a9f59d
companion: Make raw_data.__str__() a little less verbose
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.
2021-08-31 12:44:46 +01:00
Athanasius
bf33f88260
companion: Rename to capi_default_requests_timeout
So it doesn't even need a comment.
2021-08-31 12:10:59 +01:00
Athanasius
613a992ae9
companion: Change comments on CAPI cooldown/timeouts 2021-08-31 12:09:40 +01:00
Athanasius
092b10447c
EDMarketConnector.py: Early return from AppWindow.save_raw() 2021-08-31 12:09:02 +01:00
Athanasius
fd3ebc9c21
Python version: 3.9.7 2021-08-31 10:49:04 +01:00
Athanasius
d1dbd9da8f
AppWindow.capi_request_data: Specific "We're aborting query" messages 2021-08-30 12:55:45 +01:00
Athanasius
50db6c528a
EDMC: Attempt to handle CAPI exceptions as per EDMarketConnector.py
* Moved most of the exception handling/message output down to the
  outermost try's except clauses.
2021-08-28 15:34:41 +01:00
Athanasius
9e206d092c
Fix "" string to be '' 2021-08-28 14:36:54 +01:00
Athanasius
67220fc96a
CAPI: Change CAPIDataRaw.__getitem__ to using __getitem__ itself
The only use of this is stats.py, and it explicitly checks for the key's
existence first.
2021-08-28 14:35:22 +01:00
Athanasius
e3cd1d6429
EDMarketConnector: Comment about no timed CAPI retry on re-Auth 2021-08-28 14:27:20 +01:00
Athanasius
024e2ba357
EDMarketConnector: invalidate companion session and return on CredentialsError
* If we don't invalidate then the companion.Auth code will do nothing
  due to "already auth'd".
* We need to give the auth flow time to complete, so need to return.
* As that auth flow can take indeterminate time, not setting a timed
  retry of the CAPI query here.  We should consider setting a flag and
  reacting in the Auth code though.
2021-08-28 14:24:54 +01:00
Athanasius
74170da434
companion: Rename Session.session to requests_session
So as to avoid confusion with companion.session
2021-08-28 14:24:15 +01:00
Athanasius
6968cd6c69
companion: Rename Auth.session to requests_session
So as to not confuse with companion.session.
2021-08-28 14:18:49 +01:00
Athanasius
bc29891cc1
CAPI: Some notes in comments 2021-08-28 14:14:56 +01:00
Athanasius
12b1e9b7bc
CAPI: Add more trace_if('capi.worker', ...) to check timings
I keep observing it take 3-4s to update the UI after a manual CAPI
request.  This showed up as mostly *in*
AppWindow.capi_handle_response(), but the moment I ran it under PyCharm
profile that went down to 400ms.
2021-08-28 13:58:46 +01:00
Athanasius
206367505c
CAPI: Cleanup some (un)needed translations 2021-08-26 15:31:39 +01:00
Athanasius
ef32eb0140
CAPI: Remove un-needed check/setting of Session.retrying 2021-08-26 15:16:42 +01:00
Athanasius
cd6d22844b
CAPI: 'Need auth' is from 401 now, not a redirect 2021-08-26 15:15:36 +01:00
Athanasius
2179936d6f
CAPI: No need to handle HTTP 5xx specially
This will be handled by the `except HTTPError` above.
2021-08-26 15:14:52 +01:00
Athanasius
6c24d9291a
CAPI: EDMarketConnector: Don't Session.invalidate() on CredentialsError 2021-08-26 15:13:33 +01:00
Athanasius
885745197c
CAPI: EDMarketConnector: Set status text on ServerConnectionError 2021-08-26 15:00:16 +01:00
Athanasius
0637873b91
CAPI: query error - Change JSON decode error message 2021-08-26 14:54:01 +01:00
Athanasius
a53858750c
CAPI: query errors: Continue taking auth-related reactions out 2021-08-26 14:52:47 +01:00
Athanasius
816384f16f
CAPI: Begin taking auth retries out of CAPI queries
* Only set/use retrying as companion.session.retrying (untested).
* Don't call Session.login() from CAPI query code, raise
  CredentialsError instead.
* Also don't Session.close() in CAPI query code.
2021-08-26 14:44:43 +01:00
Athanasius
303df05f2c
CAPI: Adjust 'requests.ConnectionError' logging
It was specifically implying DNS resolution issues, but this is far more
general than that.
2021-08-25 14:57:08 +01:00
Athanasius
baac45f5fe
CAPI: Some extra comments for fail/auth mess 2021-08-25 14:54:53 +01:00
Athanasius
2065721dd9
CAPI: Store request retrying in companion.session.retrying
The code was already referencing the latter, just we weren't setting it
from the request yet.
2021-08-25 14:47:15 +01:00
Athanasius
05a95fbac4
companion: Update WTF comment about login/beta
This is probably a left-over from the days of email+password login, not
wanting to send that to anything but live CAPI server ?
2021-08-25 14:23:14 +01:00
Athanasius
120414ac59
CAPI: Convert StatsDialog.showstats() to using cached CAPI data
This will just bail if no data has yet been received for /profile, but
that's the same behaviour as if we don't yet have `monitor.cmdr`.
2021-08-25 14:08:36 +01:00
Athanasius
7e1e35fd48
companion: Don't self.capi_response_queue.put() a tuple 2021-08-25 13:49:25 +01:00
Athanasius
6089dc6b0e
companion: Optional[bool], not Union & minor if formatting 2021-08-25 13:48:32 +01:00
Athanasius
a48c33eda8
companion: Change record_endpoint() query_time to mandatory
This *does* need to be generated as close as possible to where the data
was received, and not rely on an actually not dynamic default.
2021-08-25 13:45:42 +01:00
Athanasius
40a8a19ce4
CAPI: Use special EDMCCAPIRequest endpoint, not 'None' for worker shutdown 2021-08-25 12:14:33 +01:00
Athanasius
503658bf4e
companion: Correct Session.profile(query_time) default 2021-08-25 12:04:13 +01:00