mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
handle missing bills data
This commit is contained in:
parent
654251c084
commit
4bcd17596e
1 changed files with 5 additions and 2 deletions
|
|
@ -98,8 +98,11 @@ def retrieve_find_my_epc_data(uprn: int, postcode: str, address: str, expected_e
|
|||
|
||||
# Retrieve the energy consumption
|
||||
bills = address_res.find('div', {'id': 'bills-affected'})
|
||||
heating_text = bills.find_all('li')[0].text
|
||||
hot_water_text = bills.find_all('li')[1].text
|
||||
bills_list = bills.find_all('li')
|
||||
if not bills_list:
|
||||
return None
|
||||
heating_text = bills_list[0].text
|
||||
hot_water_text = bills_list[1].text
|
||||
|
||||
resulting_data = {
|
||||
'extracted_uprn': uprn,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue