summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-04 20:04:39 +0100
committerAlexandre Flament <alex@al-f.net>2020-12-04 20:04:39 +0100
commitf0054d67f11bf954cd137684950b6aea2a3956b6 (patch)
tree8c4f4752d22b69a3929c79ed5ea41f63716f5663 /searx/engines
parentf56e78ee804ba7e46ffed000dbcf0b9f3b2f7ecc (diff)
downloadsearxng-f0054d67f11bf954cd137684950b6aea2a3956b6.tar.gz
searxng-f0054d67f11bf954cd137684950b6aea2a3956b6.zip
[fix] wikipedia engine: don't raise an error when the query is not found
Add a new parameter "raise_for_status", set by default to True. When True, any HTTP status code >= 300 raise an exception ( #2332 ) When False, the engine can manage the HTTP status code by itself.
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/wikipedia.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/engines/wikipedia.py b/searx/engines/wikipedia.py
index 620ec3c14..9fce170eb 100644
--- a/searx/engines/wikipedia.py
+++ b/searx/engines/wikipedia.py
@@ -37,13 +37,15 @@ def request(query, params):
language=url_lang(params['language']))
params['headers']['User-Agent'] = searx_useragent()
+ params['raise_for_status'] = False
+ params['soft_max_redirects'] = 2
return params
# get response from search-request
def response(resp):
- if not resp.ok:
+ if resp.status_code == 404:
return []
results = []