chore: format
parent
588689c230
commit
8e140a0e45
|
@ -130,7 +130,9 @@ class ZillowScraper(Scraper):
|
|||
home_info = result["hdpData"]["homeInfo"]
|
||||
address_data = {
|
||||
"street_address": home_info["streetAddress"],
|
||||
"unit": parse_address_two(home_info['unit']) if 'unit' in home_info else None,
|
||||
"unit": parse_address_two(home_info["unit"])
|
||||
if "unit" in home_info
|
||||
else None,
|
||||
"city": home_info["city"],
|
||||
"state": home_info["state"],
|
||||
"zip_code": home_info["zipcode"],
|
||||
|
|
|
@ -4,7 +4,11 @@ import re
|
|||
def parse_address_two(street_address: str):
|
||||
if not street_address:
|
||||
return None
|
||||
apt_match = re.search(r"(APT\s*[\dA-Z]+|#[\dA-Z]+|UNIT\s*[\dA-Z]+|LOT\s*[\dA-Z]+)$", street_address, re.I)
|
||||
apt_match = re.search(
|
||||
r"(APT\s*[\dA-Z]+|#[\dA-Z]+|UNIT\s*[\dA-Z]+|LOT\s*[\dA-Z]+)$",
|
||||
street_address,
|
||||
re.I,
|
||||
)
|
||||
|
||||
if apt_match:
|
||||
apt_str = apt_match.group().strip()
|
||||
|
@ -13,6 +17,7 @@ def parse_address_two(street_address: str):
|
|||
else:
|
||||
return None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(parse_address_two("810 E Colter St APT 32"))
|
||||
print(parse_address_two("1234 Elm Street apt 2B"))
|
||||
|
|
Loading…
Reference in New Issue