diff --git a/check.py b/check.py index 787763e..eb78380 100755 --- a/check.py +++ b/check.py @@ -7,6 +7,7 @@ import smtplib import sys import requests +import simplejson.errors MAIL_FROM = "edward@4angle.com" MAIL_TO = "edward@4angle.com" @@ -35,7 +36,11 @@ def send_mail(subject: str, body: str) -> None: def check_for_paris_events() -> None: """Check for upcoming OSM events in Paris and send an email if found.""" r = requests.get(URL) - events = r.json() + try: + events = r.json() + except simplejson.errors.JSONDecodeError: + print(r.text) + raise paris_events = [ event for event in events if "paris" in event["location"]["detailed"].lower()