From fe4f6e766e1952d5492e235356f890e58e41cd7d Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sat, 11 Mar 2023 00:28:23 +0100 Subject: [PATCH] Fix connection loose --- pyhon/api.py | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyhon/api.py b/pyhon/api.py index f53f3d3..b72ad7c 100644 --- a/pyhon/api.py +++ b/pyhon/api.py @@ -92,9 +92,10 @@ class HonConnection: } url = f"{const.API_URL}/commands/v1/context" async with self._session.get(url, params=params, headers=await self._headers) as response: - if response.status >= 400 and not loop: + if response.status == 403 and not loop: _LOGGER.error("%s - Error %s - %s", url, response.status, await response.text()) - await self.setup() + self._request_headers.pop("cognito-token", None) + self._request_headers.pop("id-token", None) return await self.load_attributes(device, loop=True) return (await response.json()).get("payload", {}) diff --git a/setup.py b/setup.py index a3be9f3..c3b4ba4 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open("README.md", "r") as f: setup( name="pyhOn", - version="0.3.3", + version="0.3.4", author="Andre Basche", description="Control hOn devices with python", long_description=long_description,