Commit f9d92b9b authored by Nivesh Krishna's avatar Nivesh Krishna
Browse files

Merge branch 'update-libs' into 'master'

update libs

See merge request e/cloud/my-spot!105
parents fdb1f9be bc039280
......@@ -3,17 +3,18 @@ nose2[coverage_plugin]==0.10.0
cov-core==1.15.0
pycodestyle==2.7.0
pylint==2.10.2
splinter==0.15.0
transifex-client==0.14.3
selenium==3.141.0
twine==3.4.2
Pallets-Sphinx-Themes==2.0.1
splinter==0.17.0
transifex-client==0.14.3; python_version < '3.10'
transifex-client==0.12.1; python_version == '3.10'
selenium==4.1.0
twine==3.7.1
Pallets-Sphinx-Themes==2.0.2
docutils==0.16
Sphinx==4.2.0
sphinx-issues==1.2.0
sphinx-jinja==1.1.1
Sphinx==4.4.0
sphinx-issues==3.0.1
sphinx-jinja==1.4.0
sphinx-tabs==3.2.0
sphinxcontrib-programoutput==0.17
sphinx-autobuild==2021.3.14
linuxdoc==20210324
aiounittest==1.4.0
linuxdoc==20211220
aiounittest==1.4.1
certifi==2021.5.30
certifi==2021.10.8
babel==2.9.1
flask-babel==2.0.0
flask==1.1.2
jinja2==3.0.2
lxml==4.6.3
flask==2.0.2
jinja2==3.0.3
lxml==4.7.1
pygments==2.8.0
python-dateutil==2.8.2
pyyaml==5.4.1
httpx[http2]==0.21.2
pyyaml==6.0
httpx[http2]==0.21.3
Brotli==1.0.9
uvloop==0.16.0; python_version >= '3.7'
uvloop==0.14.0; python_version < '3.7'
......
......@@ -4,7 +4,9 @@
import asyncio
import logging
from ssl import SSLContext
import threading
from typing import Any, Dict
import httpx
from httpx_socks import AsyncProxyTransport
......@@ -23,7 +25,7 @@ else:
logger = logger.getChild('searx.network.client')
LOOP = None
SSLCONTEXTS = {}
SSLCONTEXTS: Dict[Any, SSLContext] = {}
TRANSPORT_KWARGS = {
'trust_env': False,
}
......
......@@ -7,6 +7,7 @@ import atexit
import asyncio
import ipaddress
from itertools import cycle
from typing import Dict
import httpx
......@@ -16,7 +17,7 @@ from .client import new_client, get_loop, AsyncHTTPTransportNoHttp
logger = logger.getChild('network')
DEFAULT_NAME = '__DEFAULT__'
NETWORKS = {}
NETWORKS: Dict[str, 'Network'] = {}
# requests compatibility when reading proxy settings from settings.yml
PROXY_PATTERN_MAPPING = {
'http': 'http://',
......@@ -166,13 +167,14 @@ class Network:
for transport in client._mounts.values(): # pylint: disable=protected-access
if isinstance(transport, AsyncHTTPTransportNoHttp):
continue
if not getattr(transport, '_rdns', False):
result = False
break
else:
response = await client.get('https://check.torproject.org/api/ip')
if not response.json()['IsTor']:
result = False
if getattr(transport, "_pool") and getattr(
transport._pool, "_rdns", False # pylint: disable=protected-access
):
continue
return False
response = await client.get("https://check.torproject.org/api/ip", timeout=10)
if not response.json()["IsTor"]:
result = False
Network._TOR_CHECK_RESULT[proxies] = result
return result
......@@ -182,7 +184,7 @@ class Network:
local_address = next(self._local_addresses_cycle)
proxies = next(self._proxies_cycle) # is a tuple so it can be part of the key
key = (verify, max_redirects, local_address, proxies)
hook_log_response = None
hook_log_response = self.log_response if searx_debug else None
if key not in self._clients or self._clients[key].is_closed:
client = new_client(
self.enable_http,
......@@ -305,6 +307,7 @@ def initialize(settings_engines=None, settings_outgoing=None):
settings_engines = settings_engines or settings['engines']
settings_outgoing = settings_outgoing or settings['outgoing']
# default parameters for AsyncHTTPTransport
default_params = {
'enable_http': False,
'verify': True,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment