mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
debugging data pull
This commit is contained in:
parent
557c0b5898
commit
a7aecb2462
1 changed files with 6 additions and 1 deletions
|
|
@ -75,9 +75,12 @@ SOCIAL_TENURES = ["Rented (social)", "rental (social)"]
|
||||||
|
|
||||||
|
|
||||||
def process_postcode_epcs(postcode, client):
|
def process_postcode_epcs(postcode, client):
|
||||||
params = {"postcode": postcode}
|
params = {"postcode": postcode.rstrip().lstrip()}
|
||||||
url = os.path.join(client.domestic.host, "search") + "?" + urlencode({"size": 1000})
|
url = os.path.join(client.domestic.host, "search") + "?" + urlencode({"size": 1000})
|
||||||
response = client.domestic.call(method="get", url=url, params=params)
|
response = client.domestic.call(method="get", url=url, params=params)
|
||||||
|
if "rows" not in response:
|
||||||
|
logger.warning("No EPCs found for postcode %s", postcode)
|
||||||
|
return pd.DataFrame()
|
||||||
postcode_epcs = pd.DataFrame(response["rows"])
|
postcode_epcs = pd.DataFrame(response["rows"])
|
||||||
|
|
||||||
# Processing code here
|
# Processing code here
|
||||||
|
|
@ -191,6 +194,8 @@ def main():
|
||||||
epcs = []
|
epcs = []
|
||||||
for postcode in tqdm(postcodes):
|
for postcode in tqdm(postcodes):
|
||||||
postcode_epcs = process_postcode_epcs(postcode, client)
|
postcode_epcs = process_postcode_epcs(postcode, client)
|
||||||
|
if postcode_epcs.empty:
|
||||||
|
continue
|
||||||
epcs.append(postcode_epcs)
|
epcs.append(postcode_epcs)
|
||||||
|
|
||||||
# Concatenate all postcodes' data and filter it
|
# Concatenate all postcodes' data and filter it
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue