Skip to content

Commit

Permalink
[Fix] adapted query to metaodi/openerz#146
Browse files Browse the repository at this point in the history
  • Loading branch information
svenuniku committed Jan 11, 2024
1 parent d171fb3 commit 0afa5ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions openerz_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ def make_api_request(self):

payload = {
"zip": self.zip,
"types":self.waste_type,
"start": start_date,
"end": end_date,
"offset": 0,
"limit": 1,
"lang": "en",
"sort": "date",
}
url = f"http://openerz.metaodi.ch/api/calendar/{self.waste_type}.json"
url = f"https://openerz.metaodi.ch/api/calendar.json"

try:
self.last_api_response = requests.get(url, params=payload, headers=headers)
Expand All @@ -73,7 +74,7 @@ def parse_api_response(self):
return None
result_list = response_json.get("result")
first_scheduled_pickup = result_list[0]
if first_scheduled_pickup["zip"] == self.zip and first_scheduled_pickup["type"] == self.waste_type:
if first_scheduled_pickup["zip"] == self.zip and first_scheduled_pickup["waste_type"] == self.waste_type:
return first_scheduled_pickup["date"]
self.logger.warning("Either zip or waste type does not match the ones specified in the configuration.")
return None
Expand Down

0 comments on commit 0afa5ae

Please sign in to comment.