summaryrefslogtreecommitdiff
path: root/searx/engines/qwant.py
diff options
context:
space:
mode:
authorjazzzooo <38244149+jazzzooo@users.noreply.github.com>2023-09-17 06:45:07 -0700
committerMarkus Heiser <markus.heiser@darmarIT.de>2023-09-18 01:43:43 +0200
commitda1446c5ed054837f07db659e75f63374fde9299 (patch)
tree215130b1ff76c1e27db034d5e9a32de6a70f09c9 /searx/engines/qwant.py
parent7398d525c8b08931b375623b94b5df080bcced8d (diff)
downloadsearxng-da1446c5ed054837f07db659e75f63374fde9299.tar.gz
searxng-da1446c5ed054837f07db659e75f63374fde9299.zip
[fix] engine - qwant wrong error type
Diffstat (limited to 'searx/engines/qwant.py')
-rw-r--r--searx/engines/qwant.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/searx/engines/qwant.py b/searx/engines/qwant.py
index 0ffc6d1a9..30e7e237e 100644
--- a/searx/engines/qwant.py
+++ b/searx/engines/qwant.py
@@ -50,7 +50,7 @@ from flask_babel import gettext
import babel
import lxml
-from searx.exceptions import SearxEngineAPIException
+from searx.exceptions import SearxEngineAPIException, SearxEngineTooManyRequestsException
from searx.network import raise_for_httperror
from searx.enginelib.traits import EngineTraits
@@ -188,15 +188,11 @@ def parse_web_api(resp):
# check for an API error
if search_results.get('status') != 'success':
- msg = ",".join(
- data.get(
- 'message',
- [
- 'unknown',
- ],
- )
- )
- raise SearxEngineAPIException('API error::' + msg)
+ error_code = data.get('error_code')
+ if error_code == 24:
+ raise SearxEngineTooManyRequestsException()
+ msg = ",".join(data.get('message', ['unknown']))
+ raise SearxEngineAPIException(f"{msg} ({error_code})")
# raise for other errors
raise_for_httperror(resp)
@@ -220,7 +216,6 @@ def parse_web_api(resp):
return []
for row in mainline:
-
mainline_type = row.get('type', 'web')
if mainline_type != qwant_categ:
continue