summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2022-06-25 00:58:57 +0200
committerMartin Fischer <martin@push-f.com>2022-06-25 00:59:07 +0200
commit24a3fa8c5f3e0931b52cfdf6a24bfe035fa9cf31 (patch)
treeb8848b87db060a1a2070b267759542849854c2eb
parent3df9bdd164b956d3dff2ecd5b5852eea9b0c9000 (diff)
don't crash if there is no such relation
-rwxr-xr-xfetch_data.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/fetch_data.py b/fetch_data.py
index 3c77c78..a0753c4 100755
--- a/fetch_data.py
+++ b/fetch_data.py
@@ -141,7 +141,14 @@ def query_overpass(relation_ids: Collection[int], with_length: bool):
wikidata_lengths = query_lengths_from_wikidata(wikidata_ids())
for rel_id in relation_ids:
- rel = all_relations[rel_id]
+ rel = all_relations.get(rel_id)
+ if not rel:
+ # TODO: report 404 in generated data
+ print(
+ f'[warning] could not find relation {rel_id}',
+ file=sys.stderr,
+ )
+ continue
data = dict(tags={k: v for k, v in rel['tags'].items() if k in KEYS})
if with_length: