Send mail with HTML if GWR advance ticket page not parsable

This commit is contained in:
Edward Betts 2024-11-18 16:02:12 +00:00
parent f4fc839926
commit 9a204d8526

View file

@ -65,6 +65,12 @@ def update_gwr_advance_ticket_date(config: flask.config.Config) -> None:
new_html = requests.get(agenda.gwr.url).text
new_dates = agenda.gwr.extract_dates(new_html)
if not new_dates:
subject = "Error parsing GWR advance ticket booking dates"
body = new_html
agenda.mail.send_mail(config, subject, body)
return
assert new_dates
assert list(new_dates.keys()) == ["Weekdays", "Saturdays", "Sundays"]