Skip to content

Commit 0cdaff8

Browse files
committed
Added support for dates with milliseconds
Some SAML providers (salesforce in this case) return date strings with milliseconds represented in decimal. (e.g. 2008-10-31T15:07:38.68Z). This commit adds support for them.
1 parent 52abf76 commit 0cdaff8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

onelogin/saml/Response.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ def __init__(
5858
self._signature = signature
5959

6060
def _parse_datetime(self, dt):
61-
return datetime.strptime(dt, '%Y-%m-%dT%H:%M:%SZ')
61+
try:
62+
return datetime.strptime(dt, '%Y-%m-%dT%H:%M:%SZ')
63+
except ValueError:
64+
return datetime.strptime(dt, '%Y-%m-%dT%H:%M:%S.%fZ')
6265

6366
def _get_name_id(self):
6467
result = self._document.xpath(

0 commit comments

Comments
 (0)