Send mail with HTML if GWR advance ticket page not parsable
This commit is contained in:
parent
f4fc839926
commit
9a204d8526
|
@ -65,6 +65,12 @@ def update_gwr_advance_ticket_date(config: flask.config.Config) -> None:
|
||||||
new_html = requests.get(agenda.gwr.url).text
|
new_html = requests.get(agenda.gwr.url).text
|
||||||
|
|
||||||
new_dates = agenda.gwr.extract_dates(new_html)
|
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 new_dates
|
||||||
assert list(new_dates.keys()) == ["Weekdays", "Saturdays", "Sundays"]
|
assert list(new_dates.keys()) == ["Weekdays", "Saturdays", "Sundays"]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue