mirror of
https://github.com/searxng/searxng.git
synced 2026-05-31 15:07:17 +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:
+4
-2
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user