aioamazondevices 3.1.6__py3-none-any.whl → 3.1.7__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.
- aioamazondevices/__init__.py +1 -1
- aioamazondevices/api.py +14 -8
- aioamazondevices/const.py +1 -0
- {aioamazondevices-3.1.6.dist-info → aioamazondevices-3.1.7.dist-info}/METADATA +1 -1
- aioamazondevices-3.1.7.dist-info/RECORD +10 -0
- aioamazondevices-3.1.6.dist-info/RECORD +0 -10
- {aioamazondevices-3.1.6.dist-info → aioamazondevices-3.1.7.dist-info}/LICENSE +0 -0
- {aioamazondevices-3.1.6.dist-info → aioamazondevices-3.1.7.dist-info}/WHEEL +0 -0
aioamazondevices/__init__.py
CHANGED
aioamazondevices/api.py
CHANGED
@@ -49,6 +49,7 @@ from .const import (
|
|
49
49
|
URI_IDS,
|
50
50
|
URI_QUERIES,
|
51
51
|
URI_SENSORS,
|
52
|
+
URI_SIGNIN,
|
52
53
|
)
|
53
54
|
from .exceptions import (
|
54
55
|
CannotAuthenticate,
|
@@ -226,7 +227,9 @@ class AmazonEchoApi:
|
|
226
227
|
"openid.pape.max_auth_age": "0",
|
227
228
|
}
|
228
229
|
|
229
|
-
return
|
230
|
+
return (
|
231
|
+
f"https://www.amazon.{self._domain}{URI_SIGNIN}?{urlencode(oauth_params)}"
|
232
|
+
)
|
230
233
|
|
231
234
|
def _get_inputs_from_soup(self, soup: BeautifulSoup) -> dict[str, str]:
|
232
235
|
"""Extract hidden form input fields from a Amazon login page."""
|
@@ -291,13 +294,16 @@ class AmazonEchoApi:
|
|
291
294
|
_LOGGER.debug("Cookies from headers: %s", cookies_with_value)
|
292
295
|
return cookies_with_value
|
293
296
|
|
294
|
-
async def
|
295
|
-
"""Return true if error is due to
|
296
|
-
# Endpoint
|
297
|
+
async def _ignore_ap_signin_error(self, response: ClientResponse) -> bool:
|
298
|
+
"""Return true if error is due to signin endpoint."""
|
299
|
+
# Endpoint URI_SIGNIN replies with error 404
|
297
300
|
# but reports the needed parameters anyway
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
+
if history := response.history:
|
302
|
+
return (
|
303
|
+
response.status == HTTPStatus.NOT_FOUND
|
304
|
+
and URI_SIGNIN in history[0].request_info.url.path
|
305
|
+
)
|
306
|
+
return False
|
301
307
|
|
302
308
|
async def _session_request(
|
303
309
|
self,
|
@@ -357,7 +363,7 @@ class AmazonEchoApi:
|
|
357
363
|
HTTPStatus.UNAUTHORIZED,
|
358
364
|
]:
|
359
365
|
raise CannotAuthenticate(HTTPStatus(resp.status).phrase)
|
360
|
-
if not await self.
|
366
|
+
if not await self._ignore_ap_signin_error(resp):
|
361
367
|
raise CannotRetrieveData(
|
362
368
|
f"Request failed: {HTTPStatus(resp.status).phrase}"
|
363
369
|
)
|
aioamazondevices/const.py
CHANGED
@@ -0,0 +1,10 @@
|
|
1
|
+
aioamazondevices/__init__.py,sha256=aISY-rcS6SVO7yJ0uhPa9Z64Jy-gmmaZ_zHxZbaYyw8,276
|
2
|
+
aioamazondevices/api.py,sha256=d58FFzN_WEiqy3ZTquX1CKGgLRDrOSSI7Pb0Oh7ywho,35855
|
3
|
+
aioamazondevices/const.py,sha256=vDh9Ycb2ePZXqRklVWFkFZ2S2TWefGsmk9DT0dQCGCE,6361
|
4
|
+
aioamazondevices/exceptions.py,sha256=JDnSFi_7oEhqK31sHXf0S_cyMoMjiRJuLp4ow7mYgLY,643
|
5
|
+
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
aioamazondevices/sounds.py,sha256=01pVCDFIuhrLypXInw4JNuHsC6zjMLsuKocet1R6we8,13409
|
7
|
+
aioamazondevices-3.1.7.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
8
|
+
aioamazondevices-3.1.7.dist-info/METADATA,sha256=yI-YZK0Ttn8NbWB7dAdCCt5BFC7qXWJDf77XVt2E4rU,5525
|
9
|
+
aioamazondevices-3.1.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
10
|
+
aioamazondevices-3.1.7.dist-info/RECORD,,
|
@@ -1,10 +0,0 @@
|
|
1
|
-
aioamazondevices/__init__.py,sha256=VKBg94JDjfCqFMnf9UrZI1lmD10C48qsImpxT9ocDmg,276
|
2
|
-
aioamazondevices/api.py,sha256=WX0f_HR11JrVcQBu9AHZ22BvOBhiVUu2IJ8YUsIHDCc,35711
|
3
|
-
aioamazondevices/const.py,sha256=vfANuRRg8MgexiyqlVdQcIQqxJ_ptmrEAzZG77DheBo,6334
|
4
|
-
aioamazondevices/exceptions.py,sha256=JDnSFi_7oEhqK31sHXf0S_cyMoMjiRJuLp4ow7mYgLY,643
|
5
|
-
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
aioamazondevices/sounds.py,sha256=01pVCDFIuhrLypXInw4JNuHsC6zjMLsuKocet1R6we8,13409
|
7
|
-
aioamazondevices-3.1.6.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
8
|
-
aioamazondevices-3.1.6.dist-info/METADATA,sha256=sRzJ_4kiFqtQxKPOwcvVzwdZp973AwovUplk908c9Xo,5525
|
9
|
-
aioamazondevices-3.1.6.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
10
|
-
aioamazondevices-3.1.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|