mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 18:07:37 +03:00
Merge branch 'develop' into feature/847/capi-fleetcarrier
This commit is contained in:
commit
cb2a6b6995
@ -1329,7 +1329,7 @@ class AppWindow(object):
|
||||
|
||||
except companion.CredentialsRequireRefresh:
|
||||
# We need to 'close' the auth else it'll see STATE_OK and think login() isn't needed
|
||||
companion.session.close()
|
||||
companion.session.reinit_session()
|
||||
# LANG: Frontier CAPI Access Token expired, trying to get a new one
|
||||
self.status['text'] = _('CAPI: Refreshing access token...')
|
||||
if companion.session.login():
|
||||
|
1
LICENSE
1
LICENSE
@ -337,4 +337,3 @@ proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
||||
|
||||
|
14
companion.py
14
companion.py
@ -735,6 +735,14 @@ class Session(object):
|
||||
self.auth = None
|
||||
raise # Bad thing happened
|
||||
|
||||
def close(self) -> None:
|
||||
"""Close the `request.Session()."""
|
||||
try:
|
||||
self.requests_session.close()
|
||||
|
||||
except Exception as e:
|
||||
logger.debug('Frontier Auth: closing', exc_info=e)
|
||||
|
||||
def reinit_session(self, reopen: bool = True) -> None:
|
||||
"""
|
||||
Re-initialise the session's `request.Session()`.
|
||||
@ -742,11 +750,7 @@ class Session(object):
|
||||
:param reopen: Whether to open a new session.
|
||||
"""
|
||||
self.state = Session.STATE_INIT
|
||||
try:
|
||||
self.requests_session.close()
|
||||
|
||||
except Exception as e:
|
||||
logger.debug('Frontier Auth: closing', exc_info=e)
|
||||
self.close()
|
||||
|
||||
if reopen:
|
||||
self.requests_session = requests.Session()
|
||||
|
Loading…
x
Reference in New Issue
Block a user