If JSON fails to parse show the body of the response.
This commit is contained in:
parent
01409b7246
commit
dbb72495fe
5
check.py
5
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)
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue