Fix awareness of token expiration

This commit is contained in:
Maël Kervella 2018-05-25 09:29:57 +00:00
parent 74fa513e9a
commit 8432eafdca

View file

@ -19,7 +19,8 @@ class Re2oAPIClient:
self.token = self._obtain_token()
def _need_renew_token(self):
return self.token['expiration'] > datetime.datetime.utcnow() + \
return self.token['expiration'] > \
datetime.datetime.now(datetime.timezone.utc) + \
datetime.timedelta(seconds=TIME_FOR_RENEW)
def _obtain_token(self):