Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
Change session refresh time
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-r committed Apr 12, 2024
1 parent fbf5fdc commit 56dac65
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions custom_components/o2/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def create_session(self, username=None, password=None):
self._password = password

self._token_birth = time()

return True

def get_device_info(self):
Expand Down Expand Up @@ -69,8 +68,8 @@ def get_csrf(self):
return data_page_response.text.split("Liferay.authToken = '")[1].split("'")[0]

def _post(self, url):
# Refresh token if its over x mins old
if time() - self._token_birth > 3600:
# Refresh token if its over 30 mins old
if time() - self._token_birth > 1800:
self.create_session()

csrfToken = self.get_csrf()
Expand Down

0 comments on commit 56dac65

Please sign in to comment.