From 64cccae99e625f3ebd879f94797decd0d824608d Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Thu, 26 Nov 2020 17:22:54 +0100 Subject: [mod] various engines: use eval_xpath* functions and searx.exceptions.* Engine list: ahmia, duckduckgo_images, elasticsearch, google, google_images, google_videos, youtube_api --- searx/engines/elasticsearch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'searx/engines/elasticsearch.py') diff --git a/searx/engines/elasticsearch.py b/searx/engines/elasticsearch.py index 99e93d876..081736c1c 100644 --- a/searx/engines/elasticsearch.py +++ b/searx/engines/elasticsearch.py @@ -1,5 +1,6 @@ from json import loads, dumps from requests.auth import HTTPBasicAuth +from searx.exceptions import SearxEngineAPIException base_url = 'http://localhost:9200' @@ -107,7 +108,7 @@ def response(resp): resp_json = loads(resp.text) if 'error' in resp_json: - raise Exception(resp_json['error']) + raise SearxEngineAPIException(resp_json['error']) for result in resp_json['hits']['hits']: r = {key: str(value) if not key.startswith('_') else value for key, value in result['_source'].items()} -- cgit v1.2.3