mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-06 18:33:13 +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:
parent
2b79b89803
commit
e65a1e6afa
@ -733,7 +733,7 @@ class Session(object):
|
|||||||
self.auth = None
|
self.auth = None
|
||||||
raise # Bad thing happened
|
raise # Bad thing happened
|
||||||
|
|
||||||
def close(self) -> None:
|
def close(self, reopen: bool = True) -> None:
|
||||||
"""Close Frontier authorization session."""
|
"""Close Frontier authorization session."""
|
||||||
self.state = Session.STATE_INIT
|
self.state = Session.STATE_INIT
|
||||||
if self.requests_session:
|
if self.requests_session:
|
||||||
@ -742,8 +742,11 @@ class Session(object):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug('Frontier Auth: closing', exc_info=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:
|
def invalidate(self) -> None:
|
||||||
"""Invalidate Frontier authorization credentials."""
|
"""Invalidate Frontier authorization credentials."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user