commit: 7eb27848c2beaa4b5737cc1d52480c510548a21e
parent: 0b3d632cd0f0fb81db8bc70957ce525ef428c0dd
Author: Adam Tauber <asciimoo@gmail.com>
Date: Sat, 20 Dec 2014 11:58:34 +0100
Merge pull request #159 from pointhi/photon_fix
[fix] fix language support in photon engine
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/searx/engines/photon.py b/searx/engines/photon.py
@@ -23,6 +23,9 @@ base_url = 'https://photon.komoot.de/'
search_string = 'api/?{query}&limit={limit}'
result_base_url = 'https://openstreetmap.org/{osm_type}/{osm_id}'
+# list of supported languages
+allowed_languages = ['de', 'en', 'fr', 'it']
+
# do search-request
def request(query, params):
@@ -31,8 +34,9 @@ def request(query, params):
limit=number_of_results)
if params['language'] != 'all':
- params['url'] = params['url'] +\
- "&lang=" + params['language'].replace('_', '-')
+ language = params['language'].split('_')[0]
+ if language in allowed_languages:
+ params['url'] = params['url'] + "&lang=" + language
# using searx User-Agent
params['headers']['User-Agent'] = searx_useragent()