From 35b26495c2b29bdc238e69bd966b8ac0431676d1 Mon Sep 17 00:00:00 2001 From: "Josh.5" Date: Mon, 25 Mar 2024 10:05:01 +1300 Subject: [PATCH] Further improve previous fix If the stored value is a float, then we should not change it. Only convert to a timestamp if the stored value was read as a datetime.datetime object --- unmanic/libs/session.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/unmanic/libs/session.py b/unmanic/libs/session.py index ab9dfcd1..998f1c2a 100644 --- a/unmanic/libs/session.py +++ b/unmanic/libs/session.py @@ -30,9 +30,11 @@ """ import base64 +import datetime import pickle import random import time + import requests from unmanic import config @@ -163,8 +165,7 @@ def __update_created_timestamp(self): # together to register if the site goes down self.created = (seconds + seconds_offset) # Print only the accurate update time in debug log - from datetime import datetime - created = datetime.fromtimestamp(seconds) + created = datetime.datetime.fromtimestamp(seconds) self.logger.debug('Updated session at %s', str(created)) def __fetch_installation_data(self): @@ -189,7 +190,9 @@ def __fetch_installation_data(self): self.picture_uri = str(current_installation.picture_uri) self.name = str(current_installation.name) self.email = str(current_installation.email) - self.created = current_installation.created.timestamp() if current_installation.created else None + self.created = current_installation.created if current_installation.created else None + if isinstance(self.created, datetime.datetime): + self.created = self.created.timestamp() self.__update_session_auth(access_token=current_installation.user_access_token, session_cookies=current_installation.session_cookies)