python-homewizard-energy 6.1.1__tar.gz → 6.3.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-homewizard-energy
3
- Version: 6.1.1
3
+ Version: 6.3.0b1
4
4
  Summary: Asynchronous Python client for the HomeWizard Energy
5
5
  Home-page: https://github.com/homewizard/python-homewizard-energy
6
6
  License: Apache-2.0
@@ -15,6 +15,8 @@ Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: aiohttp (>=3.0.0)
17
17
  Requires-Dist: async-timeout (>=4.0.3,<5.0.0)
18
+ Requires-Dist: backoff (>=2.2.1,<3.0.0)
19
+ Requires-Dist: multidict (>=6.0.5,<7.0.0)
18
20
  Project-URL: Bug Tracker, https://github.com/homewizard/python-homewizard-energy/issues
19
21
  Project-URL: Changelog, https://github.com/homewizard/python-homewizard-energy/releases
20
22
  Project-URL: Documentation, https://github.com/homewizard/python-homewizard-energy
@@ -9,6 +9,7 @@ from http import HTTPStatus
9
9
  from typing import Any, TypeVar
10
10
 
11
11
  import async_timeout
12
+ import backoff
12
13
  from aiohttp.client import ClientError, ClientResponseError, ClientSession
13
14
  from aiohttp.hdrs import METH_GET, METH_PUT
14
15
 
@@ -145,6 +146,7 @@ class HomeWizardEnergy:
145
146
  await self.request("api/v1/identify", method=METH_PUT)
146
147
  return True
147
148
 
149
+ @backoff.on_exception(backoff.expo, RequestError, max_tries=5)
148
150
  async def request(
149
151
  self, path: str, method: str = METH_GET, data: object = None
150
152
  ) -> Any:
@@ -169,11 +171,11 @@ class HomeWizardEnergy:
169
171
  _LOGGER.debug("%s, %s", resp.status, await resp.text("utf-8"))
170
172
  except asyncio.TimeoutError as exception:
171
173
  raise RequestError(
172
- "Timeout occurred while connecting to the HomeWizard Energy device"
174
+ f"Timeout occurred while connecting to the HomeWizard Energy device at {self.host}"
173
175
  ) from exception
174
176
  except (ClientError, ClientResponseError) as exception:
175
177
  raise RequestError(
176
- "Error occurred while communicating with the HomeWizard Energy device"
178
+ f"Error occurred while communicating with the HomeWizard Energy device at {self.host}"
177
179
  ) from exception
178
180
 
179
181
  if resp.status == HTTPStatus.FORBIDDEN:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-homewizard-energy"
3
- version = "6.1.1"
3
+ version = "6.3.0-beta-1"
4
4
  description = "Asynchronous Python client for the HomeWizard Energy"
5
5
  authors = ["DCSBL"]
6
6
  maintainers = ["DCSBL"]
@@ -19,6 +19,8 @@ packages = [
19
19
  python = "^3.9"
20
20
  aiohttp = ">=3.0.0"
21
21
  async-timeout = "^4.0.3"
22
+ multidict = "^6.0.5" ## To fix aiohttp dependency at python 3.12
23
+ backoff = "^2.2.1"
22
24
 
23
25
  [tool.poetry.dev-dependencies]
24
26
  aresponses = "^3.0.0"
@@ -31,7 +33,7 @@ pre-commit = "^3.7.1"
31
33
  pre-commit-hooks = "^4.6.0"
32
34
  pylint = "^3.1.0"
33
35
  pytest = "^7.4.4"
34
- pytest-asyncio = "^0.23.7"
36
+ pytest-asyncio = "^0.23.8"
35
37
  pytest-cov = "^5.0.0"
36
38
  yamllint = "^1.35.1"
37
39
  pyupgrade = "^3.16.0"