1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

[enh] add option to configure proxies per engine - closes #1827

This commit is contained in:
Adam Tauber 2020-09-01 15:57:35 +02:00
parent b329058c1a
commit 4a913247b2
3 changed files with 12 additions and 4 deletions

View File

@ -49,16 +49,19 @@ offline boolean engine runs offline
settings.yml
------------
======================= =========== ===========================================
======================= =========== =============================================
argument type information
======================= =========== ===========================================
======================= =========== =============================================
name string name of search-engine
engine string name of searx-engine
(filename without ``.py``)
shortcut string shortcut of search-engine
timeout string specific timeout for search-engine
display_error_messages boolean display error messages on the web UI
======================= =========== ===========================================
proxies dict set proxies for a specific engine
(e.g. ``proxies : {http: socks5://proxy:port,
https: socks5://proxy:port}``)
======================= =========== =============================================
overrides

View File

@ -95,7 +95,8 @@ def request(method, url, **kwargs):
session = SessionSinglePool()
# proxies
kwargs['proxies'] = settings['outgoing'].get('proxies') or None
if kwargs.get('proxies') is None:
kwargs['proxies'] = settings['outgoing'].get('proxies')
# timeout
if 'timeout' in kwargs:

View File

@ -70,6 +70,10 @@ def send_http_request(engine, request_params):
verify=request_params['verify']
)
# setting engine based proxies
if hasattr(engine, 'proxies'):
request_args['proxies'] = engine.proxies
# specific type of request (GET or POST)
if request_params['method'] == 'GET':
req = requests_lib.get