mirror of
https://github.com/searxng/searxng
synced 2024-11-18 15:26:25 +00:00
[fix] engine - qwant wrong error type
This commit is contained in:
parent
7398d525c8
commit
da1446c5ed
@ -50,7 +50,7 @@ from flask_babel import gettext
|
|||||||
import babel
|
import babel
|
||||||
import lxml
|
import lxml
|
||||||
|
|
||||||
from searx.exceptions import SearxEngineAPIException
|
from searx.exceptions import SearxEngineAPIException, SearxEngineTooManyRequestsException
|
||||||
from searx.network import raise_for_httperror
|
from searx.network import raise_for_httperror
|
||||||
from searx.enginelib.traits import EngineTraits
|
from searx.enginelib.traits import EngineTraits
|
||||||
|
|
||||||
@ -188,15 +188,11 @@ def parse_web_api(resp):
|
|||||||
|
|
||||||
# check for an API error
|
# check for an API error
|
||||||
if search_results.get('status') != 'success':
|
if search_results.get('status') != 'success':
|
||||||
msg = ",".join(
|
error_code = data.get('error_code')
|
||||||
data.get(
|
if error_code == 24:
|
||||||
'message',
|
raise SearxEngineTooManyRequestsException()
|
||||||
[
|
msg = ",".join(data.get('message', ['unknown']))
|
||||||
'unknown',
|
raise SearxEngineAPIException(f"{msg} ({error_code})")
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
raise SearxEngineAPIException('API error::' + msg)
|
|
||||||
|
|
||||||
# raise for other errors
|
# raise for other errors
|
||||||
raise_for_httperror(resp)
|
raise_for_httperror(resp)
|
||||||
@ -220,7 +216,6 @@ def parse_web_api(resp):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
for row in mainline:
|
for row in mainline:
|
||||||
|
|
||||||
mainline_type = row.get('type', 'web')
|
mainline_type = row.get('type', 'web')
|
||||||
if mainline_type != qwant_categ:
|
if mainline_type != qwant_categ:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user