Skip to content

Commit

Permalink
Fix session oopsie
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrayner committed Feb 11, 2024
1 parent c588e47 commit ec8b617
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions podpointclient/helpers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ 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

@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:
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion podpointclient/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version for the podpointclient library"""

__version__ = "1.4.1"
__version__ = "1.4.2"

0 comments on commit ec8b617

Please sign in to comment.