1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 08:40:34 +03:00

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.
This commit is contained in:
Athanasius 2022-12-16 15:35:59 +00:00
parent ba68397b3f
commit 729016cf38
No known key found for this signature in database
GPG Key ID: 772697E181BB2767

View File

@ -601,7 +601,7 @@ class EDMCCAPIFailedRequest(EDMCCAPIReturn):
):
super().__init__(query_time=query_time, play_sound=play_sound, auto_update=auto_update)
self.message: str = message # User-friendly reason for failure.
self.exception: BaseException = exception # Exception that recipient should raise.
self.exception: Exception = exception # Exception that recipient should raise.
class Session(object):
@ -619,7 +619,7 @@ class Session(object):
def __init__(self) -> None:
self.state = Session.STATE_INIT
self.credentials: Optional[Dict[str, Any]] = None
self.requests_session: Optional[requests.Session] = None
self.requests_session: Optional[requests.Session] = requests.Session()
self.auth: Optional[Auth] = None
self.retrying = False # Avoid infinite loop when successful auth / unsuccessful query
self.tk_master: Optional[tk.Tk] = None