lghorizon 0.7.3b1__tar.gz → 0.7.3b2__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.
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/PKG-INFO +1 -1
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon/__init__.py +5 -1
- lghorizon-0.7.3b2/lghorizon/exceptions.py +17 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon/lghorizon_api.py +16 -6
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon.egg-info/PKG-INFO +1 -1
- lghorizon-0.7.3b1/lghorizon/exceptions.py +0 -11
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/.coverage +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/.flake8 +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/.github/workflows/build-on-pr.yml +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/.github/workflows/publish-to-pypi.yml +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/.gitignore +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/LICENSE +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/README.md +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/instructions.txt +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon/const.py +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon/helpers.py +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon/models.py +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon/py.typed +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon.egg-info/SOURCES.txt +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon.egg-info/dependency_links.txt +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon.egg-info/not-zip-safe +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon.egg-info/requires.txt +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lghorizon.egg-info/top_level.txt +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/lib64 +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/pyvenv.cfg +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/renovate.json +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/secrets_stub.json +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/setup.cfg +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/setup.py +0 -0
- {lghorizon-0.7.3b1 → lghorizon-0.7.3b2}/test.py +0 -0
|
@@ -9,7 +9,11 @@ from .models import (
|
|
|
9
9
|
LGHorizonRecordingEpisode,
|
|
10
10
|
LGHorizonCustomer,
|
|
11
11
|
)
|
|
12
|
-
from .exceptions import
|
|
12
|
+
from .exceptions import (
|
|
13
|
+
LGHorizonApiUnauthorizedError,
|
|
14
|
+
LGHorizonApiConnectionError,
|
|
15
|
+
LGHorizonApiLockedError,
|
|
16
|
+
)
|
|
13
17
|
from .const import (
|
|
14
18
|
ONLINE_RUNNING,
|
|
15
19
|
ONLINE_STANDBY,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""Exceptions for the LGHorizon API."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class LGHorizonApiError(Exception):
|
|
5
|
+
"""Generic LGHorizon exception."""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class LGHorizonApiConnectionError(LGHorizonApiError):
|
|
9
|
+
"""Generic LGHorizon exception."""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class LGHorizonApiUnauthorizedError(Exception):
|
|
13
|
+
"""Generic LGHorizon exception."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class LGHorizonApiLockedError(LGHorizonApiUnauthorizedError):
|
|
17
|
+
"""Generic LGHorizon exception."""
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
import json
|
|
5
5
|
import sys, traceback
|
|
6
|
-
from .exceptions import
|
|
6
|
+
from .exceptions import (
|
|
7
|
+
LGHorizonApiUnauthorizedError,
|
|
8
|
+
LGHorizonApiConnectionError,
|
|
9
|
+
LGHorizonApiLockedError,
|
|
10
|
+
)
|
|
7
11
|
import backoff
|
|
8
12
|
from requests import Session, exceptions as request_exceptions
|
|
9
13
|
from paho.mqtt.client import WebsocketConnectionError
|
|
@@ -82,9 +86,6 @@ class LGHorizonApi:
|
|
|
82
86
|
self._identifier = identifier
|
|
83
87
|
self._profile_id = profile_id
|
|
84
88
|
|
|
85
|
-
@backoff.on_exception(
|
|
86
|
-
backoff.expo, LGHorizonApiConnectionError, max_tries=3, logger=_logger
|
|
87
|
-
)
|
|
88
89
|
def _authorize(self) -> None:
|
|
89
90
|
ctry_code = self._country_code[0:2]
|
|
90
91
|
if ctry_code == "be":
|
|
@@ -111,6 +112,8 @@ class LGHorizonApi:
|
|
|
111
112
|
error = error_json["error"]
|
|
112
113
|
if error and error["statusCode"] == 97401:
|
|
113
114
|
raise LGHorizonApiUnauthorizedError("Invalid credentials")
|
|
115
|
+
elif error and error["statusCode"] == 97117:
|
|
116
|
+
raise LGHorizonApiLockedError("Account locked")
|
|
114
117
|
elif error:
|
|
115
118
|
raise LGHorizonApiConnectionError(error["message"])
|
|
116
119
|
else:
|
|
@@ -236,7 +239,14 @@ class LGHorizonApi:
|
|
|
236
239
|
_logger.debug(f"MQTT token: {self._auth.mqttToken}")
|
|
237
240
|
|
|
238
241
|
@backoff.on_exception(
|
|
239
|
-
backoff.expo,
|
|
242
|
+
backoff.expo,
|
|
243
|
+
BaseException,
|
|
244
|
+
jitter=None,
|
|
245
|
+
max_tries=3,
|
|
246
|
+
logger=_logger,
|
|
247
|
+
giveup=lambda e: isinstance(
|
|
248
|
+
e, (LGHorizonApiLockedError, LGHorizonApiUnauthorizedError)
|
|
249
|
+
),
|
|
240
250
|
)
|
|
241
251
|
def connect(self) -> None:
|
|
242
252
|
self._config = self._get_config(self._country_code)
|
|
@@ -256,7 +266,7 @@ class LGHorizonApi:
|
|
|
256
266
|
def disconnect(self):
|
|
257
267
|
"""Disconnect."""
|
|
258
268
|
_logger.debug("Disconnect from API")
|
|
259
|
-
if not self._mqttClient.is_connected:
|
|
269
|
+
if not self._mqttClient or not self._mqttClient.is_connected:
|
|
260
270
|
return
|
|
261
271
|
self._mqttClient.disconnect()
|
|
262
272
|
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"""Exceptions for the LGHorizon API."""
|
|
2
|
-
|
|
3
|
-
class LGHorizonApiError(Exception):
|
|
4
|
-
"""Generic GeocachingApi exception."""
|
|
5
|
-
|
|
6
|
-
class LGHorizonApiConnectionError(LGHorizonApiError):
|
|
7
|
-
"""Generic GeocachingApi exception."""
|
|
8
|
-
|
|
9
|
-
class LGHorizonApiUnauthorizedError(Exception):
|
|
10
|
-
"""Generic GeocachingApi exception."""
|
|
11
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|