Fix a bug where an exception would be shown when parsing the BOTA page if there were no upcoming activations.

This commit is contained in:
Ian Renton
2026-01-13 21:38:58 +00:00
parent 67b9c3bc50
commit abdf8d3065

View File

@@ -20,7 +20,9 @@ class BOTA(HTTPAlertProvider):
new_alerts = []
# Find the table of upcoming alerts
bs = BeautifulSoup(http_response.content.decode(), features="lxml")
tbody = bs.body.find('div', attrs={'class': 'view-activations-public'}).find('table', attrs={'class': 'views-table'}).find('tbody')
forthcoming_activations_div = bs.body.find('div', attrs={'class': 'view-activations-public'})
if forthcoming_activations_div:
tbody = forthcoming_activations_div.find('table', attrs={'class': 'views-table'}).find('tbody')
for row in tbody.find_all('tr'):
cells = row.find_all('td')
first_cell_text = str(cells[0].find('a').contents[0]).strip()