Geography: Fix crash in nominatim.py when some results are not OSM objects

This commit is contained in:
Valentin Lorentz 2021-11-09 22:01:59 +01:00
parent 162e974aba
commit 696d82ccfe
2 changed files with 1 additions and 4 deletions

View File

@ -31,8 +31,6 @@
import json
import time
import string
import datetime
import threading
import urllib.parse
@ -77,4 +75,4 @@ def search_osmids(query):
on the query format"""
data = _query_nominatim("/search", {"format": "json", "q": query})
return [item["osm_id"] for item in data]
return [item["osm_id"] for item in data if item.get("osm_id")]

View File

@ -114,5 +114,4 @@ class GeographyNominatimTestCase(SupyTestCase):
self.assertEqual(results[0], 450381, results)
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: