Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vivab_se fix bug, where falkenberg address do not work #2389

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading