Skip to content

Commit

Permalink
Further improve previous fix
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Josh5 committed Mar 24, 2024
1 parent a6a30c4 commit 35b2649
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions unmanic/libs/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
"""
import base64
import datetime
import pickle
import random
import time

import requests

from unmanic import config
Expand Down Expand Up @@ -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):
Expand All @@ -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)
Expand Down

0 comments on commit 35b2649

Please sign in to comment.