aioamazondevices 3.5.0__py3-none-any.whl → 3.5.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.
@@ -1,6 +1,6 @@
1
1
  """aioamazondevices library."""
2
2
 
3
- __version__ = "3.5.0"
3
+ __version__ = "3.5.1"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
aioamazondevices/api.py CHANGED
@@ -129,19 +129,19 @@ class AmazonEchoApi:
129
129
  # Force country digits as lower case
130
130
  country_code = login_country_code.lower()
131
131
 
132
- locale = DOMAIN_BY_ISO3166_COUNTRY.get(country_code)
133
- domain = locale["domain"] if locale else country_code
132
+ locale = DOMAIN_BY_ISO3166_COUNTRY.get(country_code, {})
133
+ domain = locale.get("domain", country_code)
134
+ market = locale.get("market", f"https://www.amazon.{domain}")
135
+ assoc_handle = locale.get(
136
+ "openid.assoc_handle", f"{DEFAULT_ASSOC_HANDLE}_{country_code}"
137
+ )
134
138
 
135
- if locale and (assoc := locale.get("openid.assoc_handle")):
136
- assoc_handle = assoc
137
- else:
138
- assoc_handle = f"{DEFAULT_ASSOC_HANDLE}_{country_code}"
139
139
  self._assoc_handle = assoc_handle
140
-
141
140
  self._login_email = login_email
142
141
  self._login_password = login_password
143
142
  self._login_country_code = country_code
144
143
  self._domain = domain
144
+ self._market = market
145
145
  self._cookies = self._build_init_cookies()
146
146
  self._csrf_cookie: str | None = None
147
147
  self._save_raw_data = save_raw_data
@@ -158,9 +158,10 @@ class AmazonEchoApi:
158
158
  self._language = f"{lang_maximized.language}-{lang_maximized.region}"
159
159
 
160
160
  _LOGGER.debug(
161
- "Initialize library with domain <%s> and language <%s>",
161
+ "Initialize library: domain <amazon.%s>, language <%s>, market: <%s>",
162
162
  self._domain,
163
163
  self._language,
164
+ self._market,
164
165
  )
165
166
 
166
167
  def _load_website_cookies(self) -> dict[str, str]:
@@ -584,16 +585,14 @@ class AmazonEchoApi:
584
585
  raise CannotAuthenticate
585
586
 
586
587
  resp_me_json = await resp_me.json()
587
- market = resp_me_json["marketPlaceDomainName"]
588
-
589
- _domain = f"https://www.amazon.{self._domain}"
588
+ amazon_market = resp_me_json["marketPlaceDomainName"]
590
589
 
591
- if market != _domain:
590
+ if amazon_market != self._market:
592
591
  _LOGGER.warning(
593
592
  "Selected country <%s> doesn't matches Amazon API reply:\n%s\n vs \n%s",
594
593
  self._login_country_code.upper(),
595
- {"site ": _domain},
596
- {"market": market},
594
+ {"input ": self._market},
595
+ {"amazon": amazon_market},
597
596
  )
598
597
  raise WrongCountry
599
598
 
aioamazondevices/const.py CHANGED
@@ -49,9 +49,7 @@ DOMAIN_BY_ISO3166_COUNTRY = {
49
49
  "be": {
50
50
  "domain": "com.be",
51
51
  },
52
- "br": {
53
- "domain": "com.br",
54
- },
52
+ "br": AMAZON_US_OVERRIDE | {"market": "https://www.amazon.com.br"},
55
53
  "gb": {
56
54
  "domain": "co.uk",
57
55
  "openid.assoc_handle": f"{DEFAULT_ASSOC_HANDLE}_uk",
@@ -63,6 +61,10 @@ DOMAIN_BY_ISO3166_COUNTRY = {
63
61
  "mx": {
64
62
  "domain": "com.mx",
65
63
  },
64
+ "nl": {
65
+ "domain": "nl",
66
+ "market": "https://www.amazon.co.uk",
67
+ },
66
68
  "no": AMAZON_DE_OVERRIDE,
67
69
  "nz": {
68
70
  "domain": "com.au",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aioamazondevices
3
- Version: 3.5.0
3
+ Version: 3.5.1
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=T7EODwcUnfDoPVfBfmfht_5uiC_fNyf1qm4chgXqIY4,276
2
+ aioamazondevices/api.py,sha256=kFdkvBHlGI1OITnRt1j8eASdVOzPLuftSF4U5jb6j28,40686
3
+ aioamazondevices/const.py,sha256=mQT0FAGqVtWsN6W93EzzwjqrMf7x8OT02TXdUCpKFus,9143
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.5.1.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
9
+ aioamazondevices-3.5.1.dist-info/METADATA,sha256=IsrgAsKKym47Tmp7AkEipP5DCBEI_3pahiESCPe0HRw,6929
10
+ aioamazondevices-3.5.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
+ aioamazondevices-3.5.1.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- aioamazondevices/__init__.py,sha256=SO50Vs8-iDMMTQLhMsVQ6k0U00dNKsYyi7_Pyu2hORk,276
2
- aioamazondevices/api.py,sha256=e2wrZeOPbAzhMKHgTYbAozvDq_isIQTtLhfxrSev5kI,40640
3
- aioamazondevices/const.py,sha256=qeaGMLGKH4r-84EjBvMzj1BcwgRRcDD551TUsUu4AiI,9029
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.5.0.dist-info/LICENSE,sha256=sS48k5sp9bFV-NSHDfAJuTZZ_-AP9ZDqUzQ9sffGlsg,11346
9
- aioamazondevices-3.5.0.dist-info/METADATA,sha256=uYsNGuIZW5xxdRy7rgbhUKx-PWcpDfmFP-7gvE3fFfE,6929
10
- aioamazondevices-3.5.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
11
- aioamazondevices-3.5.0.dist-info/RECORD,,