summaryrefslogtreecommitdiff
path: root/searx/network
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-05-28 18:45:22 +0200
committerAlexandre Flament <alex@al-f.net>2021-06-01 08:10:15 +0200
commit4b07df62e5906e98315e9e856db8f39b2f28f36e (patch)
tree8ab5a8d8e012aabfe55d01f3157ec7bff897c8d3 /searx/network
parent856729226d5822a3285483689f9f8ba5c2bafc07 (diff)
downloadsearxng-4b07df62e5906e98315e9e856db8f39b2f28f36e.tar.gz
searxng-4b07df62e5906e98315e9e856db8f39b2f28f36e.zip
[mod] move all default settings into searx.settings_defaults
Diffstat (limited to 'searx/network')
-rw-r--r--searx/network/network.py28
1 files changed, 11 insertions, 17 deletions
diff --git a/searx/network/network.py b/searx/network/network.py
index 37777b0d5..e7dc5b56e 100644
--- a/searx/network/network.py
+++ b/searx/network/network.py
@@ -224,28 +224,22 @@ def initialize(settings_engines=None, settings_outgoing=None):
global NETWORKS
- settings_engines = settings_engines or settings.get('engines')
- settings_outgoing = settings_outgoing or settings.get('outgoing')
+ settings_engines = settings_engines or settings['engines']
+ settings_outgoing = settings_outgoing or settings['outgoing']
# default parameters for AsyncHTTPTransport
# see https://github.com/encode/httpx/blob/e05a5372eb6172287458b37447c30f650047e1b8/httpx/_transports/default.py#L108-L121 # pylint: disable=line-too-long
default_params = {
'enable_http': False,
'verify': True,
- 'enable_http2': settings_outgoing.get('enable_http2', True),
- # Magic number kept from previous code
- 'max_connections': settings_outgoing.get('pool_connections', 100),
- # Picked from constructor
- 'max_keepalive_connections': settings_outgoing.get('pool_maxsize', 10),
- #
- 'keepalive_expiry': settings_outgoing.get('keepalive_expiry', 5.0),
- 'local_addresses': settings_outgoing.get('source_ips'),
- 'proxies': settings_outgoing.get('proxies'),
- # default maximum redirect
- # from https://github.com/psf/requests/blob/8c211a96cdbe9fe320d63d9e1ae15c5c07e179f8/requests/models.py#L55
- 'max_redirects': settings_outgoing.get('max_redirects', 30),
- #
- 'retries': settings_outgoing.get('retries', 0),
+ 'enable_http2': settings_outgoing['enable_http2'],
+ 'max_connections': settings_outgoing['pool_connections'],
+ 'max_keepalive_connections': settings_outgoing['pool_maxsize'],
+ 'keepalive_expiry': settings_outgoing['keepalive_expiry'],
+ 'local_addresses': settings_outgoing['source_ips'],
+ 'proxies': settings_outgoing['proxies'],
+ 'max_redirects': settings_outgoing['max_redirects'],
+ 'retries': settings_outgoing['retries'],
'retry_on_http_error': None,
}
@@ -274,7 +268,7 @@ def initialize(settings_engines=None, settings_outgoing=None):
NETWORKS['ipv6'] = new_network({'local_addresses': '::'})
# define networks from outgoing.networks
- for network_name, network in settings_outgoing.get('networks', {}).items():
+ for network_name, network in settings_outgoing['networks'].items():
NETWORKS[network_name] = new_network(network)
# define networks from engines.[i].network (except references)