From 33cc388ec3e465a33edb2e56693048044954de2b Mon Sep 17 00:00:00 2001 From: conway220 Date: Mon, 27 Feb 2023 08:40:28 -0500 Subject: [PATCH] fix: added request token_expiry to authenticate --- src/southern_company_api/parser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/southern_company_api/parser.py b/src/southern_company_api/parser.py index 9a8244a..9b812df 100644 --- a/src/southern_company_api/parser.py +++ b/src/southern_company_api/parser.py @@ -96,6 +96,9 @@ async def connect(self) -> None: async def authenticate(self) -> bool: """Determines if you can authenticate with Southern Company with given login""" self._request_token = await get_request_verification_token(self.session) + self._request_token_expiry = datetime.datetime.now() + datetime.timedelta( + hours=3 + ) self._sc = await self._get_sc_web_token() return True @@ -135,6 +138,7 @@ async def _get_sc_web_token(self) -> str: else: return sc_data.group(1) else: + self._sc = None raise NoScTokenFound("Login request did not return a sc token") async def _get_southern_jwt_cookie(self) -> str: