mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2026-11-04 01:42:26 +03:00
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.
This commit is contained in:
1 file changed
+5
-2
+5
-2
@@ -733,7 +733,7 @@ class Session(object):
|
||||
self.auth = None
|
||||
raise # Bad thing happened
|
||||
|
||||
def close(self) -> None:
|
||||
def close(self, reopen: bool = True) -> None:
|
||||
"""Close Frontier authorization session."""
|
||||
self.state = Session.STATE_INIT
|
||||
if self.requests_session:
|
||||
@@ -742,8 +742,11 @@ class Session(object):
|
||||
|
||||
except Exception as e:
|
||||
logger.debug('Frontier Auth: closing', exc_info=e)
|
||||
self.requests_session = None
|
||||
|
||||
self.requests_session = None
|
||||
# 2022-12-21: Current callers all need a *new* session.
|
||||
if reopen:
|
||||
self.requests_session = requests.Session()
|
||||
|
||||
def invalidate(self) -> None:
|
||||
"""Invalidate Frontier authorization credentials."""
|
||||
|
||||
Reference in new issue
Block a user