From 91a2f7ab97f2ff027263316ecc99d09f62555be6 Mon Sep 17 00:00:00 2001 From: Julian Lemmerich Date: Tue, 19 Nov 2024 21:14:47 +0100 Subject: [PATCH] handle RFC3339 date-format catch timestamp error and attempt to convert from isoformat --- jwt_tool.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jwt_tool.py b/jwt_tool.py index 99ca1ab..f509bd5 100644 --- a/jwt_tool.py +++ b/jwt_tool.py @@ -1190,7 +1190,10 @@ def dissectPayl(paylDict, count=False): else: placeholder = "+" if claim in ["exp", "nbf", "iat"]: - timestamp = datetime.fromtimestamp(int(paylDict[claim])) + try: + timestamp = datetime.fromtimestamp(int(paylDict[claim])) + except ValueError: + timestamp = datetime.fromisoformat(paylDict[claim]) if claim == "exp": if int(timestamp.timestamp()) < nowtime: expiredtoken = True