Skip to content

Commit

Permalink
Change session handling (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli committed Sep 11, 2019
1 parent efa7bfd commit a97d266
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion connect_box/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ async def async_get_devices(self) -> List[Device]:

return self.devices

async def async_logout(self) -> None:
async def async_close_session(self) -> None:
"""Logout and close session."""
if not self.token:
return

await self._async_ws_function(CMD_LOGOUT)
self.token = None

async def async_initialize_token(self) -> None:
"""Get the token first."""
Expand Down
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async def main():
await client.async_get_devices()
print(client.devices)

await client.async_logout()
await client.async_close_session()


loop = asyncio.get_event_loop()
Expand Down

0 comments on commit a97d266

Please sign in to comment.