mirror of
https://github.com/searxng/searxng.git
synced 2025-07-31 00:52:22 +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
|
@ -143,7 +143,8 @@ def send_http_request(engine, request_params):
|
|||
response = req(request_params['url'], **request_args)
|
||||
|
||||
# check HTTP status
|
||||
response.raise_for_status()
|
||||
if request_params.get('raise_for_status'):
|
||||
response.raise_for_status()
|
||||
|
||||
# check soft limit of the redirect count
|
||||
if len(response.history) > soft_max_redirects:
|
||||
|
@ -340,7 +341,8 @@ def default_request_params():
|
|||
'url': '',
|
||||
'cookies': {},
|
||||
'verify': True,
|
||||
'auth': None
|
||||
'auth': None,
|
||||
'raise_for_status': True
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue