mirror of
https://github.com/searxng/searxng
synced 2024-11-05 06:01:05 +00:00
[coding-style] searx/network/client.py - normalized indentations
No functional change! Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
e4211da639
commit
1499002ceb
@ -150,7 +150,8 @@ def get_transport_for_socks_proxy(verify, http2, local_address, proxy_url, limit
|
|||||||
|
|
||||||
proxy_type, proxy_host, proxy_port, proxy_username, proxy_password = parse_proxy_url(proxy_url)
|
proxy_type, proxy_host, proxy_port, proxy_username, proxy_password = parse_proxy_url(proxy_url)
|
||||||
verify = get_sslcontexts(proxy_url, None, True, False, http2) if verify is True else verify
|
verify = get_sslcontexts(proxy_url, None, True, False, http2) if verify is True else verify
|
||||||
return AsyncProxyTransportFixed(proxy_type=proxy_type, proxy_host=proxy_host, proxy_port=proxy_port,
|
return AsyncProxyTransportFixed(
|
||||||
|
proxy_type=proxy_type, proxy_host=proxy_host, proxy_port=proxy_port,
|
||||||
username=proxy_username, password=proxy_password,
|
username=proxy_username, password=proxy_password,
|
||||||
rdns=rdns,
|
rdns=rdns,
|
||||||
loop=get_loop(),
|
loop=get_loop(),
|
||||||
@ -161,7 +162,8 @@ def get_transport_for_socks_proxy(verify, http2, local_address, proxy_url, limit
|
|||||||
max_keepalive_connections=limit.max_keepalive_connections,
|
max_keepalive_connections=limit.max_keepalive_connections,
|
||||||
keepalive_expiry=limit.keepalive_expiry,
|
keepalive_expiry=limit.keepalive_expiry,
|
||||||
retries=retries,
|
retries=retries,
|
||||||
**TRANSPORT_KWARGS)
|
**TRANSPORT_KWARGS
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_transport(verify, http2, local_address, proxy_url, limit, retries):
|
def get_transport(verify, http2, local_address, proxy_url, limit, retries):
|
||||||
@ -193,21 +195,27 @@ def new_client(
|
|||||||
enable_http, verify, enable_http2,
|
enable_http, verify, enable_http2,
|
||||||
max_connections, max_keepalive_connections, keepalive_expiry,
|
max_connections, max_keepalive_connections, keepalive_expiry,
|
||||||
proxies, local_address, retries, max_redirects ):
|
proxies, local_address, retries, max_redirects ):
|
||||||
limit = httpx.Limits(max_connections=max_connections,
|
limit = httpx.Limits(
|
||||||
|
max_connections=max_connections,
|
||||||
max_keepalive_connections=max_keepalive_connections,
|
max_keepalive_connections=max_keepalive_connections,
|
||||||
keepalive_expiry=keepalive_expiry)
|
keepalive_expiry=keepalive_expiry
|
||||||
|
)
|
||||||
# See https://www.python-httpx.org/advanced/#routing
|
# See https://www.python-httpx.org/advanced/#routing
|
||||||
mounts = {}
|
mounts = {}
|
||||||
for pattern, proxy_url in iter_proxies(proxies):
|
for pattern, proxy_url in iter_proxies(proxies):
|
||||||
if not enable_http and (pattern == 'http' or pattern.startswith('http://')):
|
if not enable_http and (pattern == 'http' or pattern.startswith('http://')):
|
||||||
continue
|
continue
|
||||||
if proxy_url.startswith('socks4://') \
|
if (proxy_url.startswith('socks4://')
|
||||||
or proxy_url.startswith('socks5://') \
|
or proxy_url.startswith('socks5://')
|
||||||
or proxy_url.startswith('socks5h://'):
|
or proxy_url.startswith('socks5h://')
|
||||||
mounts[pattern] = get_transport_for_socks_proxy(verify, enable_http2, local_address, proxy_url, limit,
|
):
|
||||||
retries)
|
mounts[pattern] = get_transport_for_socks_proxy(
|
||||||
|
verify, enable_http2, local_address, proxy_url, limit, retries
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
mounts[pattern] = get_transport(verify, enable_http2, local_address, proxy_url, limit, retries)
|
mounts[pattern] = get_transport(
|
||||||
|
verify, enable_http2, local_address, proxy_url, limit, retries
|
||||||
|
)
|
||||||
|
|
||||||
if not enable_http:
|
if not enable_http:
|
||||||
mounts['http://'] = AsyncHTTPTransportNoHttp()
|
mounts['http://'] = AsyncHTTPTransportNoHttp()
|
||||||
|
Loading…
Reference in New Issue
Block a user