Skip to content

Commit f81dfb9

Browse files
committed
z time support for lower version of python
1 parent 616fa51 commit f81dfb9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

msal/managed_identity.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,8 @@ def _parse_expires_on(raw: str) -> int:
477477
r'(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d+)([+-]\d{2}:\d{2})',
478478
r'\1\3',
479479
raw)
480+
if raw.endswith("Z"): # fromisoformat() doesn't support Z before 3.11
481+
raw = raw[:-1] + "+00:00"
480482
return int(datetime.datetime.fromisoformat(raw).timestamp())
481483
except ValueError:
482484
pass

0 commit comments

Comments
 (0)