aioamazondevices 3.2.0__py3-none-any.whl → 3.2.1__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 +17 -1
- aioamazondevices/const.py +1 -0
- {aioamazondevices-3.2.0.dist-info → aioamazondevices-3.2.1.dist-info}/METADATA +1 -1
- aioamazondevices-3.2.1.dist-info/RECORD +11 -0
- aioamazondevices-3.2.0.dist-info/RECORD +0 -11
- {aioamazondevices-3.2.0.dist-info → aioamazondevices-3.2.1.dist-info}/LICENSE +0 -0
- {aioamazondevices-3.2.0.dist-info → aioamazondevices-3.2.1.dist-info}/WHEEL +0 -0
aioamazondevices/__init__.py
CHANGED
aioamazondevices/api.py
CHANGED
@@ -32,6 +32,7 @@ from .const import (
|
|
32
32
|
AMAZON_DEVICE_TYPE,
|
33
33
|
BIN_EXTENSION,
|
34
34
|
CSRF_COOKIE,
|
35
|
+
DEFAULT_AGENT,
|
35
36
|
DEFAULT_ASSOC_HANDLE,
|
36
37
|
DEFAULT_HEADERS,
|
37
38
|
DEVICE_TO_IGNORE,
|
@@ -161,7 +162,17 @@ class AmazonEchoApi:
|
|
161
162
|
if not self._login_stored_data:
|
162
163
|
return {}
|
163
164
|
|
164
|
-
|
165
|
+
website_cookies: dict[str, Any] = self._login_stored_data["website_cookies"]
|
166
|
+
website_cookies.update(
|
167
|
+
{
|
168
|
+
"session-token": self._login_stored_data["store_authentication_cookie"][
|
169
|
+
"cookie"
|
170
|
+
]
|
171
|
+
}
|
172
|
+
)
|
173
|
+
website_cookies.update({"lc-acbit": self._language})
|
174
|
+
|
175
|
+
return website_cookies
|
165
176
|
|
166
177
|
def _serial_number(self) -> str:
|
167
178
|
"""Get or calculate device serial number."""
|
@@ -325,6 +336,7 @@ class AmazonEchoApi:
|
|
325
336
|
url: str,
|
326
337
|
input_data: dict[str, Any] | None = None,
|
327
338
|
json_data: bool = False,
|
339
|
+
amazon_user_agent: bool = True,
|
328
340
|
) -> tuple[BeautifulSoup, ClientResponse]:
|
329
341
|
"""Return request response context data."""
|
330
342
|
_LOGGER.debug(
|
@@ -337,6 +349,9 @@ class AmazonEchoApi:
|
|
337
349
|
|
338
350
|
headers = DEFAULT_HEADERS
|
339
351
|
headers.update({"Accept-Language": self._language})
|
352
|
+
if not amazon_user_agent:
|
353
|
+
_LOGGER.debug("Changing User-Agent to %s", DEFAULT_AGENT)
|
354
|
+
headers.update({"User-Agent": DEFAULT_AGENT})
|
340
355
|
if self._csrf_cookie and CSRF_COOKIE not in headers:
|
341
356
|
csrf = {CSRF_COOKIE: self._csrf_cookie}
|
342
357
|
_LOGGER.debug("Adding <%s> to headers", csrf)
|
@@ -556,6 +571,7 @@ class AmazonEchoApi:
|
|
556
571
|
_, raw_resp = await self._session_request(
|
557
572
|
"GET",
|
558
573
|
url=f"https://alexa.amazon.{self._domain}{URI_IDS}",
|
574
|
+
amazon_user_agent=False,
|
559
575
|
)
|
560
576
|
json_data = await raw_resp.json()
|
561
577
|
|
aioamazondevices/const.py
CHANGED
@@ -86,6 +86,7 @@ DEFAULT_HEADERS = {
|
|
86
86
|
"Accept-Encoding": "gzip",
|
87
87
|
"Connection": "keep-alive",
|
88
88
|
}
|
89
|
+
DEFAULT_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0" # noqa: E501
|
89
90
|
CSRF_COOKIE = "csrf"
|
90
91
|
|
91
92
|
NODE_DEVICES = "devices"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
aioamazondevices/__init__.py,sha256=ylzOup7JB2cQ19iiOzvj0UaBpJlY2v4hV0fxxJyVeqo,276
|
2
|
+
aioamazondevices/api.py,sha256=8wXIou_9WeFjbNS4_qPbQ8YFWUfN8EdIbivQ-UWSGDI,39218
|
3
|
+
aioamazondevices/const.py,sha256=q2TlD1O4jPtQ-hIxCCZuD-uoXCFNudF11JSjSC2hClY,8687
|
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.1.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
9
|
+
aioamazondevices-3.2.1.dist-info/METADATA,sha256=qS7EZlIpIOa1F0BMNwW0Z3iAI_g5vFlXv3WSitr7NqI,5234
|
10
|
+
aioamazondevices-3.2.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
11
|
+
aioamazondevices-3.2.1.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
aioamazondevices/__init__.py,sha256=2bsaWXIfe39pE5Jjw25d1t7wCVNWK36dLG4zXoSQZpU,276
|
2
|
-
aioamazondevices/api.py,sha256=W4LyCmiWCSJlHzpTSAQkb8DMcZbBQxJufZ3lnSasiik,38648
|
3
|
-
aioamazondevices/const.py,sha256=J47aHAfoA6rRgHDvn-q_S4xp8MrC6O1rEk1ZeRnN-8E,8529
|
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.0.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
9
|
-
aioamazondevices-3.2.0.dist-info/METADATA,sha256=7d6AfzuC3n4IVSV1FWk37dR_Ruej_mCc1coKc5KE_yY,5234
|
10
|
-
aioamazondevices-3.2.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
11
|
-
aioamazondevices-3.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|