1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-19 02:40:11 +01:00

[fix] wikipedia autocomplete error handling

This commit is contained in:
Adam Tauber 2014-03-29 17:15:59 +01:00
parent 8e2d996e27
commit d2f89f0446

View File

@ -42,7 +42,9 @@ def wikipedia(query):
url = 'https://en.wikipedia.org/w/api.php?action=opensearch&{0}&limit=10&namespace=0&format=json' # noqa url = 'https://en.wikipedia.org/w/api.php?action=opensearch&{0}&limit=10&namespace=0&format=json' # noqa
resp = loads(get(url.format(urlencode(dict(q=query)))).text) resp = loads(get(url.format(urlencode(dict(q=query)))).text)
if len(resp) > 1:
return resp[1] return resp[1]
return []
backends = {'dbpedia': dbpedia, backends = {'dbpedia': dbpedia,