From ec8b617f51c7095b123f7d5e9fef83b92ad2ef8b Mon Sep 17 00:00:00 2001 From: Matt Rayner Date: Sun, 11 Feb 2024 09:34:00 +0000 Subject: [PATCH] Fix session oopsie --- podpointclient/helpers/auth.py | 9 +++++---- podpointclient/version.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/podpointclient/helpers/auth.py b/podpointclient/helpers/auth.py index 07b09f4..ccad223 100644 --- a/podpointclient/helpers/auth.py +++ b/podpointclient/helpers/auth.py @@ -27,6 +27,7 @@ def __init__( self.access_token: str = None self.refresh_token: str = None self.access_token_expiry: datetime = None + self.session: Session = None self._session: aiohttp.ClientSession = session self._api_wrapper: APIWrapper = APIWrapper(session=self._session) self._http_debug: bool = http_debug if http_debug is not None else False @@ -34,8 +35,8 @@ def __init__( @property def user_id(self): """Return the user_id for a given session""" - if self._session: - return self._session.user_id + if self.session: + return self.session.user_id return None def check_access_token(self) -> bool: @@ -67,14 +68,14 @@ async def async_update_access_token(self) -> bool: self.access_token_expiry ) - self._session = Session( + self.session = Session( email=self.email, password=self.password, access_token=self.access_token, session=self._session, http_debug=self._http_debug ) - session_created = await self._session.create() + session_created = await self.session.create() if session_created is False: _LOGGER.error("Error creating session") diff --git a/podpointclient/version.py b/podpointclient/version.py index 0100bd2..0b18852 100644 --- a/podpointclient/version.py +++ b/podpointclient/version.py @@ -1,3 +1,3 @@ """Version for the podpointclient library""" -__version__ = "1.4.1" +__version__ = "1.4.2"