From 491bf0c68b274e2af06dbb7caf8067b547e05c5c Mon Sep 17 00:00:00 2001 From: Miguel Ballesteros Date: Fri, 30 Aug 2024 17:01:12 -0500 Subject: [PATCH] Fixed UTC conversion failed in GH test --- src/factiva/analytics/auth/oauthuser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/factiva/analytics/auth/oauthuser.py b/src/factiva/analytics/auth/oauthuser.py index 8725404..1fa60ed 100755 --- a/src/factiva/analytics/auth/oauthuser.py +++ b/src/factiva/analytics/auth/oauthuser.py @@ -188,7 +188,7 @@ def get_id_token(self) -> bool: self._access_token = response_body['access_token'] bearer_payload = eval(base64.b64decode(self._access_token.split('.')[1] + '==').decode('utf-8')) # self._id_expiration = datetime.datetime.utcfromtimestamp(int(bearer_payload['exp'])).replace(tzinfo=datetime.timezone.utc) - self._id_expiration = datetime.datetime.fromtimestamp(int(bearer_payload['exp']), datetime.UTC) + self._id_expiration = datetime.datetime.fromtimestamp(int(bearer_payload['exp']), datetime.timezone.utc) return True elif authn_response.status_code == 403: raise PermissionError('Invalid user credentials') @@ -234,7 +234,7 @@ def get_jwt_token(self) -> bool: self._jwt_token = response_body["access_token"] bearer_payload = eval(base64.b64decode(self._jwt_token.split('.')[1] + '==').decode('utf-8')) # self._jwt_expiration = datetime.datetime.utcfromtimestamp(int(bearer_payload['exp'])).replace(tzinfo=datetime.timezone.utc) - self._jwt_expiration = datetime.datetime.fromtimestamp(int(bearer_payload['exp']), datetime.UTC) + self._jwt_expiration = datetime.datetime.fromtimestamp(int(bearer_payload['exp']), datetime.timezone.utc) return True