From d186b8448aa52f94981c7e02614dede67d4adfc9 Mon Sep 17 00:00:00 2001 From: 5ila5 <38183212+5ila5@users.noreply.github.com> Date: Tue, 31 Oct 2023 16:04:57 +0100 Subject: [PATCH] fix landkreis_kusel_de (#1371) Co-authored-by: 5ila5 <5ila5@users.noreply.github.com> --- .../source/landkreis_kusel_de.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/landkreis_kusel_de.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/landkreis_kusel_de.py index 2f50fa620..ea4f53bda 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/landkreis_kusel_de.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/landkreis_kusel_de.py @@ -1,3 +1,5 @@ +from datetime import datetime, timedelta + import requests from bs4 import BeautifulSoup, NavigableString from waste_collection_schedule import Collection # type: ignore[attr-defined] @@ -63,12 +65,14 @@ def fetch(self): raise Exception( f"could not find matching 'Ortsgemeinde' please check your spelling at {API_URL}" ) - + now = datetime.now() args = { "search_ak_pickup[akPickup]": pickup_id, "search_ak_pickup[wasteType]": "0", - "search_ak_pickup[startDate]": "", - "search_ak_pickup[endDate]": "", + "search_ak_pickup[startDate]": now.strftime("%Y-%m-%d"), + "search_ak_pickup[endDate]": (now + timedelta(days=365)).strftime( + "%Y-%m-%d" + ), "search_ak_pickup[search]": "", }