From 9f09614c3410ad85ae916e68bf2dc1d3d3a3f383 Mon Sep 17 00:00:00 2001 From: EnergyX <74157307+prvakt@users.noreply.github.com> Date: Tue, 31 Dec 2024 09:54:50 +0100 Subject: [PATCH] Revert "send current timestamp inside departure info request (#302)" This reverts commit 94aa29ac1643cb4c0d99da4ba031e849317c4d33. --- myskoda/rest_api.py | 16 +--------------- tests/test_rest_api.py | 7 +------ 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/myskoda/rest_api.py b/myskoda/rest_api.py index 1bbb19f0..1226d463 100644 --- a/myskoda/rest_api.py +++ b/myskoda/rest_api.py @@ -6,7 +6,6 @@ from collections.abc import Callable from dataclasses import dataclass from datetime import UTC, datetime -from urllib.parse import quote from aiohttp import ClientResponseError, ClientSession @@ -284,20 +283,7 @@ async def get_departure_timers( self, vin: str, anonymize: bool = False ) -> GetEndpointResult[DepartureInfo]: """Retrieve departure timers for the vehicle.""" - # Get the current local time with timezone - now = datetime.now().astimezone() - # Format the datetime string with timezone - formatted_time = ( - now.strftime("%Y-%m-%dT%H:%M:%S.%f") - + now.strftime("%z")[:3] - + ":" - + now.strftime("%z")[3:] - ) - - url = ( - f"/v1/vehicle-automatization/{vin}/departure/timers" - f"?deviceDateTime={quote(formatted_time, safe='')}" - ) + url = f"/v1/vehicle-automatization/{vin}/departure/timers" raw = self.process_json( data=await self._make_get_request(url), anonymize=anonymize, diff --git a/tests/test_rest_api.py b/tests/test_rest_api.py index c60dbbcd..75d0cba5 100644 --- a/tests/test_rest_api.py +++ b/tests/test_rest_api.py @@ -1,7 +1,6 @@ """Unit tests for myskoda.rest_api.""" import json -import re from pathlib import Path import pytest @@ -308,12 +307,8 @@ async def test_get_departure_timers( """Example unit test for RestAPI.charging(). Needs more work.""" for departure_timer in departure_timers: target_vin = "TMBJM0CKV1N12345" - base_url = f"https://mysmob.api.connect.skoda-auto.cz/api/v1/vehicle-automatization/{target_vin}/departure/timers" - # Add a regular expression for the dynamic timestamp query parameter - url_pattern = re.compile(rf"{base_url}\?deviceDateTime=.*") - responses.get( - url=url_pattern, + url=f"https://mysmob.api.connect.skoda-auto.cz/api/v1/vehicle-automatization/{target_vin}/departure/timers", body=departure_timer, ) get_departure_timers_result = await myskoda.get_departure_timers(target_vin)