#1117 Fix timezone on old python version
Florent Viard authored on 2020/06/27 23:58:17... | ... |
@@ -22,10 +22,11 @@ from .ExitCodes import EX_OSFILE |
22 | 22 |
|
23 | 23 |
try: |
24 | 24 |
import dateutil.parser |
25 |
+ import dateutil.tz |
|
25 | 26 |
except ImportError: |
26 | 27 |
sys.stderr.write(u""" |
27 | 28 |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
28 |
-ImportError trying to import dateutil.parser. |
|
29 |
+ImportError trying to import dateutil.parser and dateutil.tz. |
|
29 | 30 |
Please install the python dateutil module: |
30 | 31 |
$ sudo apt-get install python-dateutil |
31 | 32 |
or |
... | ... |
@@ -328,7 +329,7 @@ class Config(object): |
328 | 328 |
|
329 | 329 |
def role_refresh(self): |
330 | 330 |
if self._access_token_refresh: |
331 |
- now = datetime.datetime.now(datetime.timezone.utc) |
|
331 |
+ now = datetime.datetime.now(dateutil.tz.tzutc()) |
|
332 | 332 |
if self._access_token_expiration \ |
333 | 333 |
and now < self._access_token_expiration \ |
334 | 334 |
and self._access_token_last_update \ |