mirror of https://github.com/searx/searx
[enh] add option to configure proxies per engine - closes #1827
This commit is contained in:
parent
b329058c1a
commit
4a913247b2
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue