python-tado 0.18.15__tar.gz → 0.18.16__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.
- {python_tado-0.18.15/python_tado.egg-info → python_tado-0.18.16}/PKG-INFO +2 -2
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/http.py +20 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/interface/api/my_tado.py +2 -2
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/interface/interface.py +4 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/pyproject.toml +2 -1
- {python_tado-0.18.15 → python_tado-0.18.16/python_tado.egg-info}/PKG-INFO +2 -2
- {python_tado-0.18.15 → python_tado-0.18.16}/AUTHORS +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/LICENSE +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/__init__.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/__main__.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/const.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/exceptions.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/interface/__init__.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/interface/api/__init__.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/interface/api/hops_tado.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/logger.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/zone/__init__.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/zone/hops_zone.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/PyTado/zone/my_zone.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/README.md +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/python_tado.egg-info/SOURCES.txt +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/python_tado.egg-info/dependency_links.txt +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/python_tado.egg-info/entry_points.txt +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/python_tado.egg-info/not-zip-safe +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/python_tado.egg-info/requires.txt +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/python_tado.egg-info/top_level.txt +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/setup.cfg +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/tests/test_hops_zone.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/tests/test_http.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/tests/test_my_tado.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/tests/test_my_zone.py +0 -0
- {python_tado-0.18.15 → python_tado-0.18.16}/tests/test_tado_interface.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-tado
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.16
|
|
4
4
|
Summary: PyTado from chrism0dwk, modfied by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem
|
|
5
|
-
Author-email: Chris Jewell <chrism0dwk@gmail.com>, "w.malgadey" <w.malgadey@gmail.com>, FilBr <filippo.barba@protonmail.com>
|
|
5
|
+
Author-email: Chris Jewell <chrism0dwk@gmail.com>, "w.malgadey" <w.malgadey@gmail.com>, FilBr <filippo.barba@protonmail.com>, Erwin Douna <e.douna@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
7
7
|
Version 3, 29 June 2007
|
|
8
8
|
|
|
@@ -197,6 +197,8 @@ class Http:
|
|
|
197
197
|
self._x_api: bool | None = None
|
|
198
198
|
self._token_file_path = token_file_path
|
|
199
199
|
|
|
200
|
+
self._rate_limit: dict[str, str] = {}
|
|
201
|
+
|
|
200
202
|
if (saved_refresh_token or self._load_token()) and self._refresh_token(
|
|
201
203
|
refresh_token=saved_refresh_token, force_refresh=True
|
|
202
204
|
):
|
|
@@ -256,6 +258,11 @@ class Http:
|
|
|
256
258
|
"""
|
|
257
259
|
return self._token_refresh
|
|
258
260
|
|
|
261
|
+
@property
|
|
262
|
+
def rate_limit(self) -> dict[str, str]:
|
|
263
|
+
"""Retrieve the current rate limit information."""
|
|
264
|
+
return self._rate_limit
|
|
265
|
+
|
|
259
266
|
def _create_session(self) -> requests.Session:
|
|
260
267
|
session = requests.Session()
|
|
261
268
|
session.hooks["response"].append(self._log_response)
|
|
@@ -318,6 +325,19 @@ class Http:
|
|
|
318
325
|
if response.text is None or response.text == "":
|
|
319
326
|
return {}
|
|
320
327
|
|
|
328
|
+
# Retrieve the headers to update the rate limit info
|
|
329
|
+
# They're stored in the object memory
|
|
330
|
+
if response.headers.get("RateLimit-Policy") is not None:
|
|
331
|
+
policy = response.headers["RateLimit-Policy"]
|
|
332
|
+
rate_limit = response.headers["RateLimit"]
|
|
333
|
+
# Example: RateLimit-Policy': '"perday";q=20000;w=86400'
|
|
334
|
+
# Rate limit is stored as follows: 'RateLimit': '"perday";r=15211'
|
|
335
|
+
self._rate_limit = {
|
|
336
|
+
"per-day": policy.split(";")[1].split("=")[1],
|
|
337
|
+
"window-seconds": policy.split(";")[2].split("=")[1],
|
|
338
|
+
"remaining": rate_limit.split(";")[1].split("=")[1],
|
|
339
|
+
}
|
|
340
|
+
|
|
321
341
|
return response.json()
|
|
322
342
|
|
|
323
343
|
def _configure_url(self, request: TadoRequest) -> str:
|
|
@@ -231,7 +231,7 @@ class Tado:
|
|
|
231
231
|
request.command = f"zones/{zone:d}/schedule/activeTimetable"
|
|
232
232
|
request.action = Action.CHANGE
|
|
233
233
|
request.payload = {"id": timetable}
|
|
234
|
-
request.mode = Mode.
|
|
234
|
+
request.mode = Mode.OBJECT
|
|
235
235
|
|
|
236
236
|
self._http.request(request)
|
|
237
237
|
|
|
@@ -258,7 +258,7 @@ class Tado:
|
|
|
258
258
|
request.command = f"zones/{zone:d}/schedule/timetables/{timetable:d}/blocks/{day}"
|
|
259
259
|
request.action = Action.CHANGE
|
|
260
260
|
request.payload = data
|
|
261
|
-
request.mode = Mode.
|
|
261
|
+
request.mode = Mode.OBJECT
|
|
262
262
|
|
|
263
263
|
return self._http.request(request)
|
|
264
264
|
|
|
@@ -94,6 +94,10 @@ class Tado:
|
|
|
94
94
|
"""Returns the URL for device verification."""
|
|
95
95
|
return self._http.device_verification_url
|
|
96
96
|
|
|
97
|
+
def rate_limit_info(self) -> dict[str, str]:
|
|
98
|
+
"""Retrieve the current rate limit information."""
|
|
99
|
+
return self._http.rate_limit
|
|
100
|
+
|
|
97
101
|
def device_activation_status(self) -> DeviceActivationStatus:
|
|
98
102
|
"""Returns the status of the device activation."""
|
|
99
103
|
return self._http.device_activation_status
|
|
@@ -4,12 +4,13 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-tado"
|
|
7
|
-
version = "0.18.
|
|
7
|
+
version = "0.18.16"
|
|
8
8
|
description = "PyTado from chrism0dwk, modfied by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Chris Jewell", email = "chrism0dwk@gmail.com" },
|
|
11
11
|
{ name = "w.malgadey", email = "w.malgadey@gmail.com" },
|
|
12
12
|
{ name = "FilBr", email = "filippo.barba@protonmail.com" },
|
|
13
|
+
{ name = "Erwin Douna", email = "e.douna@gmail.com" },
|
|
13
14
|
]
|
|
14
15
|
dependencies = ["requests"]
|
|
15
16
|
requires-python = ">=3.11"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-tado
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.16
|
|
4
4
|
Summary: PyTado from chrism0dwk, modfied by w.malgadey, diplix, michaelarnauts, LenhartStephan, splifter, syssi, andersonshatch, Yippy, p0thi, Coffee2CodeNL, chiefdragon, FilBr, nikilase, albertomontesg, Moritz-Schmidt, palazzem
|
|
5
|
-
Author-email: Chris Jewell <chrism0dwk@gmail.com>, "w.malgadey" <w.malgadey@gmail.com>, FilBr <filippo.barba@protonmail.com>
|
|
5
|
+
Author-email: Chris Jewell <chrism0dwk@gmail.com>, "w.malgadey" <w.malgadey@gmail.com>, FilBr <filippo.barba@protonmail.com>, Erwin Douna <e.douna@gmail.com>
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
7
7
|
Version 3, 29 June 2007
|
|
8
8
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|