Skip to content

Commit

Permalink
Fix warszawa19115 response schedule new field name and check it is no…
Browse files Browse the repository at this point in the history
…t null
  • Loading branch information
tomek-sienicki authored and 5ila5 committed Nov 2, 2024
1 parent 1125aaa commit 1de7d67
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ def fetch(self):
calendar_result = calendar_request.json()
_LOGGER.debug(f"Calendar response: {calendar_result!r}")

harmonogramy = "harmonogramyZ"
if (
len(calendar_result) <= 0
or "harmonogramy" not in calendar_result[0]
or len(calendar_result[0]["harmonogramy"]) <= 0
or harmonogramy not in calendar_result[0]
or not calendar_result[0][harmonogramy]
or len(calendar_result[0][harmonogramy]) <= 0
):
raise SourceParseError(
"Expected list of dates from calendar search, got empty or missing list"
Expand All @@ -133,7 +135,7 @@ def fetch(self):
entries = []

for result in calendar_result:
for entry in result["harmonogramy"]:
for entry in result[harmonogramy]:
if entry["data"]:
original_type = entry["frakcja"]["id_frakcja"]
waste_type = NAME_MAP.get(original_type, original_type)
Expand Down

0 comments on commit 1de7d67

Please sign in to comment.