Skip to content

Commit

Permalink
vivab_se fix bug, where falkenberg address do not work
Browse files Browse the repository at this point in the history
  • Loading branch information
5ila5 committed Aug 6, 2024
1 parent 44c320d commit 60f024e
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
TEST_CASES = {
"Gallerian": {"street_address": "Västra Vallgatan 2, Varberg"},
"Polisen": {"street_address": "Östra Långgatan 5, Varberg"},
"Storgatan 1, FALKENBERG": {"street_address": "Storgatan 1, FALKENBERG"},
}


Expand All @@ -19,7 +20,7 @@ def __init__(self, street_address):
self._street_address = street_address

def fetch(self):
search_data = {"searchText": self._street_address}
search_data = {"searchText": self._street_address.split(",")[0].strip()}
response = requests.post(
"https://minasidor.vivab.info/FutureWebVarberg/SimpleWastePickup/SearchAdress",
data=search_data,
Expand All @@ -32,14 +33,14 @@ def fetch(self):
and "Buildings" in building_data
and len(building_data["Buildings"]) > 0
):
return []
raise ValueError("No building found")

building_id = None

# support only first building match
building_id_matches = re.findall(r"\(([0-9]+)\)", building_data["Buildings"][0])
if not building_id_matches or len(building_id_matches) == 0:
return []
raise ValueError("No building id found")
building_id = building_id_matches[0]

response = requests.get(
Expand Down

0 comments on commit 60f024e

Please sign in to comment.