aioamazondevices 3.2.3__py3-none-any.whl → 3.2.4__py3-none-any.whl

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
  """aioamazondevices library."""
2
2
 
3
- __version__ = "3.2.3"
3
+ __version__ = "3.2.4"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
aioamazondevices/api.py CHANGED
@@ -39,6 +39,8 @@ from .const import (
39
39
  DEVICE_TYPE_TO_MODEL,
40
40
  DOMAIN_BY_ISO3166_COUNTRY,
41
41
  HTML_EXTENSION,
42
+ HTTP_ERROR_199,
43
+ HTTP_ERROR_299,
42
44
  JSON_EXTENSION,
43
45
  NODE_BLUETOOTH,
44
46
  NODE_DEVICES,
@@ -336,6 +338,16 @@ class AmazonEchoApi:
336
338
  )
337
339
  return False
338
340
 
341
+ async def _http_phrase_error(self, error: int) -> str:
342
+ """Convert numeric error in human phrase."""
343
+ if error == HTTP_ERROR_199:
344
+ return "Miscellaneous Warning"
345
+
346
+ if error == HTTP_ERROR_299:
347
+ return "Miscellaneous Persistent Warning"
348
+
349
+ return HTTPStatus(error).phrase
350
+
339
351
  async def _session_request(
340
352
  self,
341
353
  method: str,
@@ -401,10 +413,10 @@ class AmazonEchoApi:
401
413
  HTTPStatus.PROXY_AUTHENTICATION_REQUIRED,
402
414
  HTTPStatus.UNAUTHORIZED,
403
415
  ]:
404
- raise CannotAuthenticate(HTTPStatus(resp.status).phrase)
416
+ raise CannotAuthenticate(self._http_phrase_error(resp.status))
405
417
  if not await self._ignore_ap_signin_error(resp):
406
418
  raise CannotRetrieveData(
407
- f"Request failed: {HTTPStatus(resp.status).phrase}"
419
+ f"Request failed: {self._http_phrase_error(resp.status)}"
408
420
  )
409
421
 
410
422
  await self._save_to_file(
@@ -515,7 +527,7 @@ class AmazonEchoApi:
515
527
  obfuscate_email(self._login_email),
516
528
  msg,
517
529
  )
518
- raise CannotRegisterDevice(f"{HTTPStatus(resp.status).phrase}: {msg}")
530
+ raise CannotRegisterDevice(f"{self._http_phrase_error(resp.status)}: {msg}")
519
531
 
520
532
  success_response = resp_json["response"]["success"]
521
533
 
aioamazondevices/const.py CHANGED
@@ -6,6 +6,9 @@ _LOGGER = logging.getLogger(__package__)
6
6
 
7
7
  DEFAULT_ASSOC_HANDLE = "amzn_dp_project_dee_ios"
8
8
 
9
+ HTTP_ERROR_199 = 199
10
+ HTTP_ERROR_299 = 299
11
+
9
12
  TO_REDACT = {
10
13
  "address",
11
14
  "address1",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aioamazondevices
3
- Version: 3.2.3
3
+ Version: 3.2.4
4
4
  Summary: Python library to control Amazon devices
5
5
  License: Apache-2.0
6
6
  Author: Simone Chemelli
@@ -0,0 +1,11 @@
1
+ aioamazondevices/__init__.py,sha256=q9wQ9Tf4eUuqR8QchKhODo4PnwT1vb0SI5IAD9BWr7k,276
2
+ aioamazondevices/api.py,sha256=VCOcIufsCHYKRBAC-q5Yfwj5Cek8Wt-ZT7o2Lg0kzyU,39691
3
+ aioamazondevices/const.py,sha256=d2kBbZXOf-RF18c4C3hwrIqDqaXhL6KzO1iSSL9_ST4,8759
4
+ aioamazondevices/exceptions.py,sha256=CfOFKDvE_yl5BFoFcpTOuDfgRi_2oAtKk-nNJgfWBAs,726
5
+ aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ aioamazondevices/sounds.py,sha256=01pVCDFIuhrLypXInw4JNuHsC6zjMLsuKocet1R6we8,13409
7
+ aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
8
+ aioamazondevices-3.2.4.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
9
+ aioamazondevices-3.2.4.dist-info/METADATA,sha256=uuwxpCyN_I64zyfIfTnzCv3pOCJrec9_3i6-Y9QpWlM,5234
10
+ aioamazondevices-3.2.4.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
+ aioamazondevices-3.2.4.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- aioamazondevices/__init__.py,sha256=ym9BWa7TjPo80kc9b_xrVPeW1cq_Xh_eDwduw3soMh4,276
2
- aioamazondevices/api.py,sha256=3o64TiaYVq_kG5upZnOynmey2Ls7ZhH7xPigFykxq8Y,39309
3
- aioamazondevices/const.py,sha256=iJ87rGFZi9FY8M-dPsFY3DNYltiJ_PCjlr4RxQtZlJQ,8716
4
- aioamazondevices/exceptions.py,sha256=CfOFKDvE_yl5BFoFcpTOuDfgRi_2oAtKk-nNJgfWBAs,726
5
- aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- aioamazondevices/sounds.py,sha256=01pVCDFIuhrLypXInw4JNuHsC6zjMLsuKocet1R6we8,13409
7
- aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
8
- aioamazondevices-3.2.3.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
9
- aioamazondevices-3.2.3.dist-info/METADATA,sha256=AZomsCQfXV4PWyyspc4PU1Xzq7HTeM7iRKbxzbU7yck,5234
10
- aioamazondevices-3.2.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
- aioamazondevices-3.2.3.dist-info/RECORD,,