aioamazondevices 0.12.0__tar.gz → 0.13.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aioamazondevices
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: Python library to control Amazon devices
5
5
  Home-page: https://github.com/chemelli74/aioamazondevices
6
6
  License: Apache-2.0
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "aioamazondevices"
3
- version = "0.12.0"
3
+ version = "0.13.0"
4
4
  description = "Python library to control Amazon devices"
5
5
  authors = ["Simone Chemelli <simone.chemelli@gmail.com>"]
6
6
  license = "Apache-2.0"
@@ -1,6 +1,6 @@
1
1
  """aioamazondevices library."""
2
2
 
3
- __version__ = "0.12.0"
3
+ __version__ = "0.13.0"
4
4
 
5
5
 
6
6
  from .api import AmazonDevice, AmazonEchoApi
@@ -2,7 +2,6 @@
2
2
 
3
3
  import base64
4
4
  import hashlib
5
- import json
6
5
  import mimetypes
7
6
  import secrets
8
7
  import uuid
@@ -66,7 +65,7 @@ class AmazonEchoApi:
66
65
  login_country_code: str,
67
66
  login_email: str,
68
67
  login_password: str,
69
- login_data_file: str | None,
68
+ login_data: dict[str, Any] | None = None,
70
69
  save_raw_data: bool = False,
71
70
  ) -> None:
72
71
  """Initialize the scanner."""
@@ -89,24 +88,12 @@ class AmazonEchoApi:
89
88
  self._cookies = self._build_init_cookies()
90
89
  self._headers = DEFAULT_HEADERS
91
90
  self._save_raw_data = save_raw_data
92
- self._login_stored_data: dict[str, Any] = self._load_data_file(login_data_file)
91
+ self._login_stored_data = login_data
93
92
  self._serial = self._serial_number()
94
93
  self._website_cookies: dict[str, Any] = self._load_website_cookies()
95
94
 
96
95
  self.session: AsyncClient
97
96
 
98
- def _load_data_file(self, data_file: str | None) -> dict[str, Any]:
99
- """Load stored login data from file."""
100
- if not data_file or not (file := Path(data_file)).exists():
101
- _LOGGER.debug(
102
- "Cannot find previous login data file <%s>",
103
- data_file,
104
- )
105
- return {}
106
-
107
- with Path.open(file, "rb") as f:
108
- return cast(dict[str, Any], json.load(f))
109
-
110
97
  def _load_website_cookies(self) -> dict[str, Any]:
111
98
  """Get website cookies, if avaliables."""
112
99
  if not self._login_stored_data: