From 88d46c1dcd45bdd756a3913865e2c6636ec08b38 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Wed, 27 Dec 2023 15:06:14 +0000 Subject: [PATCH] Use fallback if Scottish civil parish lookup fails --- lookup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lookup.py b/lookup.py index da8648c..4ecffaa 100755 --- a/lookup.py +++ b/lookup.py @@ -114,7 +114,8 @@ def lat_lon_to_wikidata(lat: float, lon: float) -> dict[str, typing.Any]: elements = [] result = wikidata.build_dict(hit, lat, lon) - return {"elements": elements, "result": result} + if not result.get("missing"): + return {"elements": elements, "result": result} elements = model.Polygon.coords_within(lat, lon) result = do_lookup(elements, lat, lon)