mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core] Add option to force refresh token instead of session resumption
This commit is contained in:
parent
ed0ac1e0b2
commit
fbb4acbc88
|
@ -174,7 +174,7 @@ class LegendaryCore:
|
||||||
self.log.error(f'Logging in failed with {e!r}, please try again.')
|
self.log.error(f'Logging in failed with {e!r}, please try again.')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def login(self) -> bool:
|
def login(self, force_refresh=False) -> bool:
|
||||||
"""
|
"""
|
||||||
Attempts logging in with existing credentials.
|
Attempts logging in with existing credentials.
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ class LegendaryCore:
|
||||||
else:
|
else:
|
||||||
self.apply_lgd_config()
|
self.apply_lgd_config()
|
||||||
|
|
||||||
if self.lgd.userdata['expires_at']:
|
if self.lgd.userdata['expires_at'] and not force_refresh:
|
||||||
dt_exp = datetime.fromisoformat(self.lgd.userdata['expires_at'][:-1])
|
dt_exp = datetime.fromisoformat(self.lgd.userdata['expires_at'][:-1])
|
||||||
dt_now = datetime.utcnow()
|
dt_now = datetime.utcnow()
|
||||||
td = dt_now - dt_exp
|
td = dt_now - dt_exp
|
||||||
|
|
Loading…
Reference in a new issue