mirror of
https://github.com/searxng/searxng.git
synced 2025-08-03 10:32:21 +02:00
[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.
This commit is contained in:
parent
f56e78ee80
commit
f0054d67f1
3 changed files with 11 additions and 6 deletions
|
@ -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 = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue