aioamazondevices 6.1.1__tar.gz → 6.1.2__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.
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/PKG-INFO +1 -1
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/pyproject.toml +1 -1
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/__init__.py +1 -1
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/api.py +13 -9
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/LICENSE +0 -0
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/README.md +0 -0
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/const.py +0 -0
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/exceptions.py +0 -0
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/py.typed +0 -0
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/query.py +0 -0
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/sounds.py +0 -0
- {aioamazondevices-6.1.1 → aioamazondevices-6.1.2}/src/aioamazondevices/utils.py +0 -0
@@ -528,15 +528,15 @@ class AmazonEchoApi:
|
|
528
528
|
}
|
529
529
|
|
530
530
|
register_url = "https://api.amazon.com/auth/register"
|
531
|
-
_,
|
531
|
+
_, raw_resp = await self._session_request(
|
532
532
|
method=HTTPMethod.POST,
|
533
533
|
url=register_url,
|
534
534
|
input_data=body,
|
535
535
|
json_data=True,
|
536
536
|
)
|
537
|
-
resp_json = await
|
537
|
+
resp_json = await raw_resp.json()
|
538
538
|
|
539
|
-
if
|
539
|
+
if raw_resp.status != HTTPStatus.OK:
|
540
540
|
msg = resp_json["response"]["error"]["message"]
|
541
541
|
_LOGGER.error(
|
542
542
|
"Cannot register device for %s: %s",
|
@@ -544,7 +544,7 @@ class AmazonEchoApi:
|
|
544
544
|
msg,
|
545
545
|
)
|
546
546
|
raise CannotRegisterDevice(
|
547
|
-
f"{await self._http_phrase_error(
|
547
|
+
f"{await self._http_phrase_error(raw_resp.status)}: {msg}"
|
548
548
|
)
|
549
549
|
|
550
550
|
success_response = resp_json["response"]["success"]
|
@@ -704,7 +704,7 @@ class AmazonEchoApi:
|
|
704
704
|
_LOGGER.debug(
|
705
705
|
'Cannot find "auth-mfa-otpcode" in html source [%s]', login_url
|
706
706
|
)
|
707
|
-
raise CannotAuthenticate
|
707
|
+
raise CannotAuthenticate("MFA OTP code not found on login page")
|
708
708
|
|
709
709
|
login_method, login_url = self._get_request_from_soup(login_soup)
|
710
710
|
|
@@ -743,6 +743,10 @@ class AmazonEchoApi:
|
|
743
743
|
obfuscate_email(self._login_email),
|
744
744
|
)
|
745
745
|
|
746
|
+
# Check if session is still authenticated
|
747
|
+
if not await self.auth_check_status():
|
748
|
+
raise CannotAuthenticate("Session no longer authenticated")
|
749
|
+
|
746
750
|
return self._login_stored_data
|
747
751
|
|
748
752
|
async def _get_alexa_domain(self) -> str:
|
@@ -1106,21 +1110,21 @@ class AmazonEchoApi:
|
|
1106
1110
|
"domain": f"www.amazon.{self._domain}",
|
1107
1111
|
}
|
1108
1112
|
|
1109
|
-
|
1113
|
+
raw_resp = await self._session.post(
|
1110
1114
|
"https://api.amazon.com/auth/token",
|
1111
1115
|
data=data,
|
1112
1116
|
)
|
1113
1117
|
_LOGGER.debug(
|
1114
1118
|
"Refresh data response %s with payload %s",
|
1115
|
-
|
1119
|
+
raw_resp.status,
|
1116
1120
|
orjson.dumps(data),
|
1117
1121
|
)
|
1118
1122
|
|
1119
|
-
if
|
1123
|
+
if raw_resp.status != HTTPStatus.OK:
|
1120
1124
|
_LOGGER.debug("Failed to refresh data")
|
1121
1125
|
return False, {}
|
1122
1126
|
|
1123
|
-
json_response = await
|
1127
|
+
json_response = await raw_resp.json()
|
1124
1128
|
_LOGGER.debug("Refresh data json:\n%s ", json_response)
|
1125
1129
|
|
1126
1130
|
if data_type == REFRESH_ACCESS_TOKEN and (
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|