pyechorobotics 2.0.0__tar.gz → 2.1.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.
Files changed (19) hide show
  1. {pyechorobotics-2.0.0/src/pyechorobotics.egg-info → pyechorobotics-2.1.0}/PKG-INFO +1 -1
  2. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/pyproject.toml +1 -1
  3. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/echoroboticsapi/api.py +3 -2
  4. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0/src/pyechorobotics.egg-info}/PKG-INFO +1 -1
  5. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/LICENSE.md +0 -0
  6. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/README.md +0 -0
  7. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/setup.cfg +0 -0
  8. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/setup.py +0 -0
  9. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/echoroboticsapi/__init__.py +0 -0
  10. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/echoroboticsapi/models.py +0 -0
  11. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/echoroboticsapi/smart_fetch.py +0 -0
  12. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/echoroboticsapi/smart_mode.py +0 -0
  13. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/pyechorobotics.egg-info/SOURCES.txt +0 -0
  14. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/pyechorobotics.egg-info/dependency_links.txt +0 -0
  15. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/pyechorobotics.egg-info/requires.txt +0 -0
  16. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/src/pyechorobotics.egg-info/top_level.txt +0 -0
  17. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/test/test_api.py +0 -0
  18. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/test/test_smart_fetch.py +0 -0
  19. {pyechorobotics-2.0.0 → pyechorobotics-2.1.0}/test/test_smart_mode.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyechorobotics
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Access API for echorobotics robot lawn mowers
5
5
  Author-email: functionpointer <suspendfunction@gmail.com>
6
6
  License: GNU General Public License v3 or later (GPLv3+)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyechorobotics"
3
- version = "2.0.0"
3
+ version = "2.1.0"
4
4
  dependencies = [
5
5
  "aiohttp",
6
6
  "yarl",
@@ -83,7 +83,7 @@ class Api:
83
83
  def token_refresh_duration(self):
84
84
  return 5 * 60 # 5 minutes
85
85
 
86
- async def get_access_token(self) -> str:
86
+ async def get_access_token(self, force_refresh: bool = False) -> str:
87
87
  """Returns a valid access token
88
88
  Performs API call to the refresh endpoint if needed.
89
89
  """
@@ -96,7 +96,7 @@ class Api:
96
96
  self.auth_info["obtained_timestamp"] + self.token_refresh_duration
97
97
  )
98
98
  - time.time()
99
- ) <= 0:
99
+ ) <= 0 or force_refresh:
100
100
  # have to refresh
101
101
  url = URL(f"https://myrobot.echorobotics.com/api/authentication/refresh")
102
102
  # url = URL(f"http://httpbin.org/cookies")
@@ -280,6 +280,7 @@ class Api:
280
280
  url_obj = URL(url)
281
281
 
282
282
  response = await self.request(method="GET", url=url_obj)
283
+ response.raise_for_status()
283
284
  json = await response.json()
284
285
  try:
285
286
  resp = Current.model_validate(json)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyechorobotics
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Access API for echorobotics robot lawn mowers
5
5
  Author-email: functionpointer <suspendfunction@gmail.com>
6
6
  License: GNU General Public License v3 or later (GPLv3+)
File without changes
File without changes
File without changes