Skip to content

Commit

Permalink
Merge pull request #38 from MislavMandaric/fix/revert-cache-hack
Browse files Browse the repository at this point in the history
Revert caching hacks
  • Loading branch information
MislavMandaric authored Jan 22, 2022
2 parents d593706 + c6af9ab commit 2015565
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
3 changes: 0 additions & 3 deletions src/vaillant_netatmo_api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from tenacity import retry, retry_if_exception_type, stop_after_attempt, stop_after_delay, wait_random_exponential

from .errors import RetryableException, client_error_handler
from .time import now

_API_HOST = "https://api.netatmo.com/"

Expand Down Expand Up @@ -48,8 +47,6 @@ async def _post(self, path: str, data: dict) -> dict:
with client_error_handler():
resp = await self._client.post(
f"{_API_HOST}{path}",
headers={"Cache-Control": "no-cache"},
params={"ts": round(now().timestamp())},
data=data,
auth=self._auth,
timeout=15.0,
Expand Down
12 changes: 0 additions & 12 deletions src/vaillant_netatmo_api/thermostat_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,6 @@ async def test_async_get_thermostats_data__valid_request_params__returns_valid_d
for x in zip(devices, expected_devices):
assert x[0] == Device(**x[1])

async def test_async_get_thermostats_data__request_data__contains_ts_param(self, respx_mock: MockRouter, mocker: MockerFixture):
some_time = datetime(2021, 11, 22, 1, 0)

mocker.patch("vaillant_netatmo_api.base.now", return_value=some_time)

respx_mock.post("https://api.netatmo.com/api/getthermostatsdata", data=get_thermostats_data_request).respond(200, json=get_thermostats_data_response)

async with thermostat_client("", "", token, None) as client:
_ = await client.async_get_thermostats_data()

assert respx_mock.calls.last.request.url.params["ts"] == str(round(some_time.timestamp()))

async def test_async_get_measure__invalid_request_params__raises_error(self, respx_mock: MockRouter):
respx_mock.post("https://api.netatmo.com/api/getmeasure", data=get_measure_request).respond(400)

Expand Down

0 comments on commit 2015565

Please sign in to comment.