mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-02-04 09:14:30 +00:00
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:
@@ -20,7 +20,9 @@ class BOTA(HTTPAlertProvider):
|
|||||||
new_alerts = []
|
new_alerts = []
|
||||||
# Find the table of upcoming alerts
|
# Find the table of upcoming alerts
|
||||||
bs = BeautifulSoup(http_response.content.decode(), features="lxml")
|
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'):
|
for row in tbody.find_all('tr'):
|
||||||
cells = row.find_all('td')
|
cells = row.find_all('td')
|
||||||
first_cell_text = str(cells[0].find('a').contents[0]).strip()
|
first_cell_text = str(cells[0].find('a').contents[0]).strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user