diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2022-08-19 17:43:17 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarit.de> | 2022-09-04 09:07:28 +0200 |
| commit | a15dfa5ee11228881f7a846f89196cbdb69021fb (patch) | |
| tree | 7054d5219bb6ad7ba6d87f4835202e2b8e8b8feb /searx/engines | |
| parent | 8e9fb0b43582aa41123dd0ff64ff5088ce0ec4c9 (diff) | |
[fix] engine woxikon.de - don't raise exception on empty result list
Woxikon expects a word in German, so with query "foo" the site finds nothing and
respons a 404:
httpx.HTTPStatusError: Client error '404 Not Found' \
for url 'https://synonyme.woxikon.de/synonyme/foo.php'
[1] https://github.com/searxng/searxng/issues/1543#issuecomment-1193317054
Closes: https://github.com/searxng/searxng/issues/1543
Suggested-by: @allendema [1]
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines')
| -rw-r--r-- | searx/engines/xpath.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index 705a5211d..97656705a 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -60,6 +60,9 @@ lang_all = 'en' '''Replacement ``{lang}`` in :py:obj:`search_url` if language ``all`` is selected. ''' +raise_for_httperror = True +'''True by default: raise an exception if the HTTP code of response is ``>= +300``''' soft_max_redirects = 0 '''Maximum redirects, soft limit. Record an error but don't stop the engine''' @@ -176,7 +179,7 @@ def request(query, params): params['url'] = search_url.format(**fargs) params['soft_max_redirects'] = soft_max_redirects - + params['raise_for_httperror'] = raise_for_httperror return params |