summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-11-16 12:44:07 +0100
committerAlexandre Flament <alex@al-f.net>2020-11-20 15:29:21 +0100
commit3786920df975b11c0feb7d8564eb19b634d32977 (patch)
tree3d0bdc1fb29ef3a5a400dd78960cc2cae22f8e1a /searx/engines
parent2fc3b17c85512280173bb47f449cc2faa64b0501 (diff)
downloadsearxng-3786920df975b11c0feb7d8564eb19b634d32977.tar.gz
searxng-3786920df975b11c0feb7d8564eb19b634d32977.zip
[enh] Add multiple outgoing proxies
credits go to @bauruine see https://github.com/searx/searx/pull/1958
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/__init__.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py
index 00be89412..a80afb1c6 100644
--- a/searx/engines/__init__.py
+++ b/searx/engines/__init__.py
@@ -25,7 +25,7 @@ from operator import itemgetter
from searx import settings
from searx import logger
from searx.data import ENGINES_LANGUAGES
-from searx.poolrequests import get
+from searx.poolrequests import get, get_proxy_cycles
from searx.utils import load_module, match_language, get_engine_from_settings
@@ -79,16 +79,18 @@ def load_engine(engine_data):
logger.exception('Cannot load engine "{}"'.format(engine_module))
return None
- for param_name in engine_data:
+ for param_name, param_value in engine_data.items():
if param_name == 'engine':
- continue
- if param_name == 'categories':
- if engine_data['categories'] == 'none':
+ pass
+ elif param_name == 'categories':
+ if param_value == 'none':
engine.categories = []
else:
- engine.categories = list(map(str.strip, engine_data['categories'].split(',')))
- continue
- setattr(engine, param_name, engine_data[param_name])
+ engine.categories = list(map(str.strip, param_value.split(',')))
+ elif param_name == 'proxies':
+ engine.proxies = get_proxy_cycles(param_value)
+ else:
+ setattr(engine, param_name, param_value)
for arg_name, arg_value in engine_default_args.items():
if not hasattr(engine, arg_name):