summaryrefslogtreecommitdiff
path: root/searx/engines/openstreetmap.py
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-07 01:15:04 +0100
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-02-07 01:15:04 +0100
commitd0a1df881aa29be713f7446ffff746043b3d0302 (patch)
treee62d406a2f2e5adb71ecf6e7313af2fe020bb5e9 /searx/engines/openstreetmap.py
parentf1c10f4fe45f34c12994b9bbc4aca133202fd7ca (diff)
downloadsearxng-d0a1df881aa29be713f7446ffff746043b3d0302.tar.gz
searxng-d0a1df881aa29be713f7446ffff746043b3d0302.zip
Openstreetmap's unit test
Diffstat (limited to 'searx/engines/openstreetmap.py')
-rw-r--r--searx/engines/openstreetmap.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py
index 68446ef5f..60c3c13ca 100644
--- a/searx/engines/openstreetmap.py
+++ b/searx/engines/openstreetmap.py
@@ -38,6 +38,9 @@ def response(resp):
# parse results
for r in json:
+ if 'display_name' not in r:
+ continue
+
title = r['display_name']
osm_type = r.get('osm_type', r.get('type'))
url = result_base_url.format(osm_type=osm_type,
@@ -49,10 +52,8 @@ def response(resp):
geojson = r.get('geojson')
# if no geojson is found and osm_type is a node, add geojson Point
- if not geojson and\
- osm_type == 'node':
- geojson = {u'type': u'Point',
- u'coordinates': [r['lon'], r['lat']]}
+ if not geojson and osm_type == 'node':
+ geojson = {u'type': u'Point', u'coordinates': [r['lon'], r['lat']]}
address_raw = r.get('address')
address = {}