python-homewizard-energy 8.0.0b3__tar.gz → 8.1.1__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.
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/PKG-INFO +1 -1
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/errors.py +7 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v1/__init__.py +8 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v2/__init__.py +19 -2
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/pyproject.toml +1 -1
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/LICENSE +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/README.md +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/__init__.py +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/const.py +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/homewizard_energy.py +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/models.py +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/py.typed +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v1/const.py +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v2/cacert.py +0 -0
- {python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v2/const.py +0 -0
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/errors.py
RENAMED
|
@@ -12,6 +12,13 @@ class RequestError(HomeWizardEnergyException):
|
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
class InvalidUserNameError(HomeWizardEnergyException):
|
|
16
|
+
"""Invalid username.
|
|
17
|
+
|
|
18
|
+
Raised when username is not valid, too short or too long.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
|
|
15
22
|
class ResponseError(HomeWizardEnergyException):
|
|
16
23
|
"""API responded unexpected."""
|
|
17
24
|
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v1/__init__.py
RENAMED
|
@@ -173,3 +173,11 @@ class HomeWizardEnergyV1(HomeWizardEnergy):
|
|
|
173
173
|
raise RequestError(f"API request error ({resp.status})")
|
|
174
174
|
|
|
175
175
|
return (resp.status, await resp.text())
|
|
176
|
+
|
|
177
|
+
async def __aenter__(self) -> HomeWizardEnergyV1:
|
|
178
|
+
"""Async enter.
|
|
179
|
+
|
|
180
|
+
Returns:
|
|
181
|
+
The HomeWizardEnergyV1 object.
|
|
182
|
+
"""
|
|
183
|
+
return self
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v2/__init__.py
RENAMED
|
@@ -16,7 +16,13 @@ from aiohttp.hdrs import METH_DELETE, METH_GET, METH_POST, METH_PUT
|
|
|
16
16
|
from mashumaro.exceptions import InvalidFieldValue, MissingField
|
|
17
17
|
|
|
18
18
|
from ..const import LOGGER
|
|
19
|
-
from ..errors import
|
|
19
|
+
from ..errors import (
|
|
20
|
+
DisabledError,
|
|
21
|
+
InvalidUserNameError,
|
|
22
|
+
RequestError,
|
|
23
|
+
ResponseError,
|
|
24
|
+
UnauthorizedError,
|
|
25
|
+
)
|
|
20
26
|
from ..homewizard_energy import HomeWizardEnergy
|
|
21
27
|
from ..models import Device, Measurement, System, SystemUpdate, Token
|
|
22
28
|
from .cacert import CACERT
|
|
@@ -158,7 +164,9 @@ class HomeWizardEnergyV2(HomeWizardEnergy):
|
|
|
158
164
|
|
|
159
165
|
if status != HTTPStatus.OK:
|
|
160
166
|
error = json.loads(response).get("error", response)
|
|
161
|
-
raise
|
|
167
|
+
raise InvalidUserNameError(
|
|
168
|
+
f"Error occurred while getting token: {error}", error
|
|
169
|
+
)
|
|
162
170
|
|
|
163
171
|
try:
|
|
164
172
|
token = Token.from_json(response).token
|
|
@@ -195,6 +203,7 @@ class HomeWizardEnergyV2(HomeWizardEnergy):
|
|
|
195
203
|
|
|
196
204
|
def _build_ssl_context() -> ssl.SSLContext:
|
|
197
205
|
context = ssl.create_default_context(cadata=CACERT)
|
|
206
|
+
context.verify_flags = ssl.VERIFY_X509_PARTIAL_CHAIN # pylint: disable=no-member
|
|
198
207
|
if self._identifier is not None:
|
|
199
208
|
context.hostname_checks_common_name = True
|
|
200
209
|
else:
|
|
@@ -259,3 +268,11 @@ class HomeWizardEnergyV2(HomeWizardEnergy):
|
|
|
259
268
|
pass
|
|
260
269
|
|
|
261
270
|
return (resp.status, await resp.text())
|
|
271
|
+
|
|
272
|
+
async def __aenter__(self) -> HomeWizardEnergyV2:
|
|
273
|
+
"""Async enter.
|
|
274
|
+
|
|
275
|
+
Returns:
|
|
276
|
+
The HomeWizardEnergyV2 object.
|
|
277
|
+
"""
|
|
278
|
+
return self
|
|
File without changes
|
|
File without changes
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/__init__.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/const.py
RENAMED
|
File without changes
|
|
File without changes
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/models.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/py.typed
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v1/const.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v2/cacert.py
RENAMED
|
File without changes
|
{python_homewizard_energy-8.0.0b3 → python_homewizard_energy-8.1.1}/homewizard_energy/v2/const.py
RENAMED
|
File without changes
|