diff options
author | Adam Tauber <asciimoo@gmail.com> | 2014-03-29 17:15:59 +0100 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2014-03-29 17:15:59 +0100 |
commit | d2f89f044624d21027741ada796580bbcea70922 (patch) | |
tree | 66941203a791004c2de69a4c8682f9a7bf58d7ce /searx | |
parent | 8e2d996e273f58d96870d1eef45139c924434236 (diff) | |
download | searxng-d2f89f044624d21027741ada796580bbcea70922.tar.gz searxng-d2f89f044624d21027741ada796580bbcea70922.zip |
[fix] wikipedia autocomplete error handling
Diffstat (limited to 'searx')
-rw-r--r-- | searx/autocomplete.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/autocomplete.py b/searx/autocomplete.py index 828e85e42..1726a8c3d 100644 --- a/searx/autocomplete.py +++ b/searx/autocomplete.py @@ -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 resp = loads(get(url.format(urlencode(dict(q=query)))).text) - return resp[1] + if len(resp) > 1: + return resp[1] + return [] backends = {'dbpedia': dbpedia, |