From 9a204d8526b6c1053f78b58ec918d78acb765ee6 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 18 Nov 2024 16:02:12 +0000 Subject: [PATCH] Send mail with HTML if GWR advance ticket page not parsable --- update.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/update.py b/update.py index a22b169..30b65a7 100755 --- a/update.py +++ b/update.py @@ -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"]