From ae05132de659f27587543a7ef224713c3baadef7 Mon Sep 17 00:00:00 2001 From: 5ila5 <5ila5@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:41:48 +0200 Subject: [PATCH 1/2] fix irenambiente_it for house_numbers with spaces --- .../waste_collection_schedule/source/irenambiente_it.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/irenambiente_it.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/irenambiente_it.py index 6a48aab68..5e12aa1c9 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/irenambiente_it.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/irenambiente_it.py @@ -39,6 +39,11 @@ "street": "ARGINE COPERMIO OVEST", "house_number": 74, }, + "Torino Corso Quintino Sella 11 Scala A": { + "city": "Torino", + "street": "Corso Quintino Sella", + "house_number": "11 Scala A", + }, } HOW_TO_GET_ARGUMENTS_DESCRIPTION = { # Optional dictionary to describe how to get the arguments, will be shown in the GUI configuration form above the input fields, does not need to be translated in all languages @@ -184,7 +189,7 @@ def get_house_numbers( "istat": city_id, "streetcode": street_code, # only use the first part of the house number if it contains a slash as this seems to break the search and the API should still return the correct address - "search": search.lower().split("/")[0], + "search": search.lower().split("/")[0].split()[0], } r = requests.get(API_URL, params=params) r.raise_for_status() From 7eac857d576321ac867844472ee241e8f566bf9e Mon Sep 17 00:00:00 2001 From: 5ila5 <5ila5@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:52:39 +0200 Subject: [PATCH 2/2] fix stirling_uk --- .../waste_collection_schedule/source/stirling_uk.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/waste_collection_schedule/waste_collection_schedule/source/stirling_uk.py b/custom_components/waste_collection_schedule/waste_collection_schedule/source/stirling_uk.py index 300c542d8..26ca421a4 100644 --- a/custom_components/waste_collection_schedule/waste_collection_schedule/source/stirling_uk.py +++ b/custom_components/waste_collection_schedule/waste_collection_schedule/source/stirling_uk.py @@ -57,6 +57,8 @@ def fetch(self): for item in scheduleItems: BinType = item.find("h2", class_="schedule__title") NextCollection = item.find("p", class_="schedule__summary") + if not NextCollection: + continue # bin_type_text = BinType.text.strip() # next_collection_text = NextCollection.text.strip().split(REM_STRING1, 1)[0].strip() # date_object = datetime.strptime(next_collection_text, "%A %d %b %Y")