aioamazondevices 6.2.6__py3-none-any.whl → 6.2.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.
Potentially problematic release.
This version of aioamazondevices might be problematic. Click here for more details.
- aioamazondevices/__init__.py +1 -1
- aioamazondevices/api.py +20 -22
- aioamazondevices/const.py +0 -3
- aioamazondevices/query.py +1 -1
- {aioamazondevices-6.2.6.dist-info → aioamazondevices-6.2.7.dist-info}/METADATA +1 -1
- aioamazondevices-6.2.7.dist-info/RECORD +12 -0
- {aioamazondevices-6.2.6.dist-info → aioamazondevices-6.2.7.dist-info}/WHEEL +1 -1
- aioamazondevices-6.2.6.dist-info/RECORD +0 -12
- {aioamazondevices-6.2.6.dist-info → aioamazondevices-6.2.7.dist-info}/licenses/LICENSE +0 -0
aioamazondevices/__init__.py
CHANGED
aioamazondevices/api.py
CHANGED
|
@@ -40,8 +40,6 @@ from .const import (
|
|
|
40
40
|
AMAZON_DEVICE_TYPE,
|
|
41
41
|
BIN_EXTENSION,
|
|
42
42
|
CSRF_COOKIE,
|
|
43
|
-
DEFAULT_AGENT,
|
|
44
|
-
DEFAULT_ASSOC_HANDLE,
|
|
45
43
|
DEFAULT_HEADERS,
|
|
46
44
|
DEFAULT_SITE,
|
|
47
45
|
DEVICE_TO_IGNORE,
|
|
@@ -88,6 +86,7 @@ class AmazonDevice:
|
|
|
88
86
|
device_family: str
|
|
89
87
|
device_type: str
|
|
90
88
|
device_owner_customer_id: str
|
|
89
|
+
household_device: bool
|
|
91
90
|
device_cluster_members: list[str]
|
|
92
91
|
online: bool
|
|
93
92
|
serial_number: str
|
|
@@ -138,6 +137,7 @@ class AmazonEchoApi:
|
|
|
138
137
|
self._save_raw_data = False
|
|
139
138
|
self._login_stored_data = login_data or {}
|
|
140
139
|
self._serial = self._serial_number()
|
|
140
|
+
self._account_owner_customer_id: str | None = None
|
|
141
141
|
self._list_for_clusters: dict[str, str] = {}
|
|
142
142
|
|
|
143
143
|
self._session = client_session
|
|
@@ -254,9 +254,9 @@ class AmazonEchoApi:
|
|
|
254
254
|
oauth_params = {
|
|
255
255
|
"openid.return_to": "https://www.amazon.com/ap/maplanding",
|
|
256
256
|
"openid.oa2.code_challenge_method": "S256",
|
|
257
|
-
"openid.assoc_handle":
|
|
257
|
+
"openid.assoc_handle": "amzn_dp_project_dee_ios",
|
|
258
258
|
"openid.identity": "http://specs.openid.net/auth/2.0/identifier_select",
|
|
259
|
-
"pageId":
|
|
259
|
+
"pageId": "amzn_dp_project_dee_ios",
|
|
260
260
|
"accountStatusPolicy": "P1",
|
|
261
261
|
"openid.claimed_id": "http://specs.openid.net/auth/2.0/identifier_select",
|
|
262
262
|
"openid.mode": "checkid_setup",
|
|
@@ -339,7 +339,6 @@ class AmazonEchoApi:
|
|
|
339
339
|
url: str,
|
|
340
340
|
input_data: dict[str, Any] | None = None,
|
|
341
341
|
json_data: bool = False,
|
|
342
|
-
amazon_user_agent: bool = True,
|
|
343
342
|
) -> tuple[BeautifulSoup, ClientResponse]:
|
|
344
343
|
"""Return request response context data."""
|
|
345
344
|
_LOGGER.debug(
|
|
@@ -352,9 +351,7 @@ class AmazonEchoApi:
|
|
|
352
351
|
|
|
353
352
|
headers = DEFAULT_HEADERS.copy()
|
|
354
353
|
headers.update({"Accept-Language": self._language})
|
|
355
|
-
|
|
356
|
-
_LOGGER.debug("Changing User-Agent to %s", DEFAULT_AGENT)
|
|
357
|
-
headers.update({"User-Agent": DEFAULT_AGENT})
|
|
354
|
+
|
|
358
355
|
if self._csrf_cookie:
|
|
359
356
|
csrf = {CSRF_COOKIE: self._csrf_cookie}
|
|
360
357
|
_LOGGER.debug("Adding to headers: %s", csrf)
|
|
@@ -370,14 +367,6 @@ class AmazonEchoApi:
|
|
|
370
367
|
)
|
|
371
368
|
self._session.cookie_jar.update_cookies(_cookies, URL(f"amazon.{self._domain}"))
|
|
372
369
|
|
|
373
|
-
if url.endswith("/auth/token"):
|
|
374
|
-
headers.update(
|
|
375
|
-
{
|
|
376
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
377
|
-
"x-amzn-identity-auth-domain": "api.amazon.com",
|
|
378
|
-
}
|
|
379
|
-
)
|
|
380
|
-
|
|
381
370
|
resp: ClientResponse | None = None
|
|
382
371
|
for delay in [0, 1, 2, 5, 8, 12, 21]:
|
|
383
372
|
if delay:
|
|
@@ -444,7 +433,7 @@ class AmazonEchoApi:
|
|
|
444
433
|
mimetypes.guess_extension(content_type.split(";")[0]) or ".raw",
|
|
445
434
|
)
|
|
446
435
|
|
|
447
|
-
return BeautifulSoup(await resp.read(), "html.parser"), resp
|
|
436
|
+
return BeautifulSoup(await resp.read() or "", "html.parser"), resp
|
|
448
437
|
|
|
449
438
|
async def _save_to_file(
|
|
450
439
|
self,
|
|
@@ -856,9 +845,14 @@ class AmazonEchoApi:
|
|
|
856
845
|
|
|
857
846
|
_LOGGER.debug("JSON devices data: %s", scrub_fields(json_data))
|
|
858
847
|
|
|
848
|
+
this_device_serial = self._login_stored_data["device_info"][
|
|
849
|
+
"device_serial_number"
|
|
850
|
+
]
|
|
859
851
|
for data in json_data["devices"]:
|
|
860
852
|
dev_serial = data.get("serialNumber")
|
|
861
853
|
self._devices[dev_serial] = data
|
|
854
|
+
if dev_serial == this_device_serial:
|
|
855
|
+
self._account_owner_customer_id = data["deviceOwnerCustomerId"]
|
|
862
856
|
|
|
863
857
|
devices_endpoints, devices_sensors = await self._get_sensors_states()
|
|
864
858
|
|
|
@@ -879,6 +873,8 @@ class AmazonEchoApi:
|
|
|
879
873
|
device_family=device["deviceFamily"],
|
|
880
874
|
device_type=device["deviceType"],
|
|
881
875
|
device_owner_customer_id=device["deviceOwnerCustomerId"],
|
|
876
|
+
household_device=device["deviceOwnerCustomerId"]
|
|
877
|
+
== self._account_owner_customer_id,
|
|
882
878
|
device_cluster_members=(device["clusterMembers"] or [serial_number]),
|
|
883
879
|
online=device["online"],
|
|
884
880
|
serial_number=serial_number,
|
|
@@ -953,7 +949,7 @@ class AmazonEchoApi:
|
|
|
953
949
|
"deviceType": device.device_type,
|
|
954
950
|
"deviceSerialNumber": device.serial_number,
|
|
955
951
|
"locale": self._language,
|
|
956
|
-
"customerId":
|
|
952
|
+
"customerId": self._account_owner_customer_id,
|
|
957
953
|
}
|
|
958
954
|
|
|
959
955
|
payload: dict[str, Any]
|
|
@@ -962,7 +958,7 @@ class AmazonEchoApi:
|
|
|
962
958
|
**base_payload,
|
|
963
959
|
"textToSpeak": message_body,
|
|
964
960
|
"target": {
|
|
965
|
-
"customerId":
|
|
961
|
+
"customerId": self._account_owner_customer_id,
|
|
966
962
|
"devices": [
|
|
967
963
|
{
|
|
968
964
|
"deviceSerialNumber": device.serial_number,
|
|
@@ -999,7 +995,7 @@ class AmazonEchoApi:
|
|
|
999
995
|
}
|
|
1000
996
|
],
|
|
1001
997
|
"target": {
|
|
1002
|
-
"customerId":
|
|
998
|
+
"customerId": self._account_owner_customer_id,
|
|
1003
999
|
"devices": playback_devices,
|
|
1004
1000
|
},
|
|
1005
1001
|
"skillId": "amzn1.ask.1p.routines.messaging",
|
|
@@ -1171,9 +1167,11 @@ class AmazonEchoApi:
|
|
|
1171
1167
|
"domain": f"www.amazon.{self._domain}",
|
|
1172
1168
|
}
|
|
1173
1169
|
|
|
1174
|
-
raw_resp = await self.
|
|
1170
|
+
_, raw_resp = await self._session_request(
|
|
1171
|
+
HTTPMethod.POST,
|
|
1175
1172
|
"https://api.amazon.com/auth/token",
|
|
1176
|
-
|
|
1173
|
+
input_data=data,
|
|
1174
|
+
json_data=False,
|
|
1177
1175
|
)
|
|
1178
1176
|
_LOGGER.debug(
|
|
1179
1177
|
"Refresh data response %s with payload %s",
|
aioamazondevices/const.py
CHANGED
|
@@ -4,8 +4,6 @@ import logging
|
|
|
4
4
|
|
|
5
5
|
_LOGGER = logging.getLogger(__package__)
|
|
6
6
|
|
|
7
|
-
DEFAULT_ASSOC_HANDLE = "amzn_dp_project_dee_ios"
|
|
8
|
-
|
|
9
7
|
HTTP_ERROR_199 = 199
|
|
10
8
|
HTTP_ERROR_299 = 299
|
|
11
9
|
|
|
@@ -48,7 +46,6 @@ DEFAULT_HEADERS = {
|
|
|
48
46
|
"Accept-Encoding": "gzip",
|
|
49
47
|
"Connection": "keep-alive",
|
|
50
48
|
}
|
|
51
|
-
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
|
|
52
49
|
CSRF_COOKIE = "csrf"
|
|
53
50
|
|
|
54
51
|
REFRESH_ACCESS_TOKEN = "access_token" # noqa: S105
|
aioamazondevices/query.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
QUERY_DEVICE_STATE = """
|
|
4
4
|
query getDevicesState ($latencyTolerance: LatencyToleranceValue) {
|
|
5
|
-
listEndpoints(listEndpointsInput: {}) {
|
|
5
|
+
listEndpoints(listEndpointsInput: { includeHouseholdDevices: true }) {
|
|
6
6
|
endpoints {
|
|
7
7
|
endpointId: id
|
|
8
8
|
friendlyNameObject { value { text } }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
aioamazondevices/__init__.py,sha256=7ypbsqEYHFGm1dMAGooQibrUEoO6tovsrqDr7KH7WwE,276
|
|
2
|
+
aioamazondevices/api.py,sha256=6F4UwDNuQXsdfVxpZKXSWVIKsoNgoFJ2whguJxT0hEM,43558
|
|
3
|
+
aioamazondevices/const.py,sha256=pPjMhNABj3rN8uvHzqj41tDiGPx-C50QRcSckvzX9z8,11561
|
|
4
|
+
aioamazondevices/exceptions.py,sha256=gRYrxNAJnrV6uRuMx5e76VMvtNKyceXd09q84pDBBrI,638
|
|
5
|
+
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
aioamazondevices/query.py,sha256=qLCuNyVlSbvVQmckZUsmftsz8s04GIukdidsOo4BrD0,2084
|
|
7
|
+
aioamazondevices/sounds.py,sha256=CXMDk-KoKVFxBdVAw3MeOClqgpzcVDxvQhFOJp7qX-Y,1896
|
|
8
|
+
aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
|
|
9
|
+
aioamazondevices-6.2.7.dist-info/METADATA,sha256=Ap2Tr3-p6e0kSf3IEdz9Vj-cqrp_EmA97IFsRb54weg,7656
|
|
10
|
+
aioamazondevices-6.2.7.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
11
|
+
aioamazondevices-6.2.7.dist-info/licenses/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
|
12
|
+
aioamazondevices-6.2.7.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
aioamazondevices/__init__.py,sha256=2rkrcsrHU_OkLuxwVmHbM2zQIokytaNz17RY5Sme80U,276
|
|
2
|
-
aioamazondevices/api.py,sha256=h3LVTzj4f2unlD8PPyezBT0OsbF5viICIK8YhT2MoIU,43533
|
|
3
|
-
aioamazondevices/const.py,sha256=laRFapeQRpg3aGi10iCOH5OzBi1cnaPJX0s1phSl21w,11769
|
|
4
|
-
aioamazondevices/exceptions.py,sha256=gRYrxNAJnrV6uRuMx5e76VMvtNKyceXd09q84pDBBrI,638
|
|
5
|
-
aioamazondevices/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
-
aioamazondevices/query.py,sha256=AGHHzefzfYzB7RLWPtlFxYc_rpUZdoeApsU2jYz3urQ,2053
|
|
7
|
-
aioamazondevices/sounds.py,sha256=CXMDk-KoKVFxBdVAw3MeOClqgpzcVDxvQhFOJp7qX-Y,1896
|
|
8
|
-
aioamazondevices/utils.py,sha256=RzuKRhnq_8ymCoJMoQJ2vBYyuew06RSWpqQWmqdNczE,2019
|
|
9
|
-
aioamazondevices-6.2.6.dist-info/METADATA,sha256=us19gN-RKVrY6ICis6RkboCyMzStX5jHSTWbbfKfAXc,7656
|
|
10
|
-
aioamazondevices-6.2.6.dist-info/WHEEL,sha256=M5asmiAlL6HEcOq52Yi5mmk9KmTVjY2RDPtO4p9DMrc,88
|
|
11
|
-
aioamazondevices-6.2.6.dist-info/licenses/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
|
|
12
|
-
aioamazondevices-6.2.6.dist-info/RECORD,,
|
|
File without changes
|