1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-19 02:40:11 +01:00

[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>
This commit is contained in:
Markus Heiser 2022-08-19 17:43:17 +02:00
parent 8e9fb0b435
commit a15dfa5ee1
2 changed files with 5 additions and 1 deletions

View File

@ -60,6 +60,9 @@ lang_all = 'en'
'''Replacement ``{lang}`` in :py:obj:`search_url` if language ``all`` is '''Replacement ``{lang}`` in :py:obj:`search_url` if language ``all`` is
selected. selected.
''' '''
raise_for_httperror = True
'''True by default: raise an exception if the HTTP code of response is ``>=
300``'''
soft_max_redirects = 0 soft_max_redirects = 0
'''Maximum redirects, soft limit. Record an error but don't stop the engine''' '''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['url'] = search_url.format(**fargs)
params['soft_max_redirects'] = soft_max_redirects params['soft_max_redirects'] = soft_max_redirects
params['raise_for_httperror'] = raise_for_httperror
return params return params

View File

@ -1808,6 +1808,7 @@ engines:
url_xpath: //div[@class="upper-synonyms"]/a/@href url_xpath: //div[@class="upper-synonyms"]/a/@href
content_xpath: //div[@class="synonyms-list-group"] content_xpath: //div[@class="synonyms-list-group"]
title_xpath: //div[@class="upper-synonyms"]/a title_xpath: //div[@class="upper-synonyms"]/a
raise_for_httperror: false
about: about:
website: https://www.woxikon.de/ website: https://www.woxikon.de/
wikidata_id: # No Wikidata ID wikidata_id: # No Wikidata ID