Refresh token happens every call, wrong order in subtraction
Closed this issue · 1 comments
JabLuszko commented
As title states - the refresh token happens every call due to wrong order of variables in subtraction - we really should expect last_time_token_refreshed
to be before now()
, so it should the other way around.
No idea if this is python version specific / timezone specifi (and 'works here') or was just overlooked :)
Not PR'ing because I have no idea how your flow for new version works and where I need to bump version number or so :)
or (self.last_time_token_refreshed - datetime.datetime.now()).seconds
<= self.access_token_lifetime
https://github.com/ahivert/tgtg-python/blob/master/tgtg/__init__.py#L75
import datetime
now = datetime.datetime.now()
last_time_token_refreshed = now-datetime.timedelta(seconds=20)
print( (now-last_time_token_refreshed).seconds )
print( (last_time_token_refreshed-now).seconds )
20
86380
ahivert commented
Good catch ! Thanks to let me know.
Fixed with version 0.5.0, available on pypi :)