Browse Source

Try fallback to address if location is missing

master
Gautier P 2 years ago
parent
commit
b19459b97f
  1. 9
      flatisfy/filters/metadata.py

9
flatisfy/filters/metadata.py

@ -147,14 +147,19 @@ def guess_postal_code(flats_list, constraint, config, distance_threshold=20000): @@ -147,14 +147,19 @@ def guess_postal_code(flats_list, constraint, config, distance_threshold=20000):
for flat in flats_list:
location = flat.get("location", None)
if not location:
addr = flat.get("address", None)
if addr:
location = addr['full_address']
if not location:
# Skip everything if empty location
LOGGER.info(
(
"No location field for flat %s, skipping postal "
"code lookup."
"code lookup. (%s)"
),
flat["id"]
flat["id"],
flat["address"]
)
continue

Loading…
Cancel
Save