Browse Source

adapt to new aiohttp_socks: fix deprecation warnings

...\electrum\electrum\util.py:1096: DeprecationWarning: SocksConnector is deprecated. Use ProxyConnector instead.
  connector = SocksConnector(
...\Python38\site-packages\aiohttp_socks\proxy\socks5_proxy.py:37: DeprecationWarning: Parameter family is deprecated and will be ignored.
  super().__init__(
hard-fail-on-bad-server-string
SomberNight 5 years ago
parent
commit
fe86f91110
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/util.py

6
electrum/util.py

@ -43,7 +43,7 @@ import ssl
import ipaddress
import aiohttp
from aiohttp_socks import SocksConnector, SocksVer
from aiohttp_socks import ProxyConnector, ProxyType
from aiorpcx import TaskGroup
import certifi
import dns.resolver
@ -1093,8 +1093,8 @@ def make_aiohttp_session(proxy: Optional[dict], headers=None, timeout=None):
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=ca_path)
if proxy:
connector = SocksConnector(
socks_ver=SocksVer.SOCKS5 if proxy['mode'] == 'socks5' else SocksVer.SOCKS4,
connector = ProxyConnector(
proxy_type=ProxyType.SOCKS5 if proxy['mode'] == 'socks5' else ProxyType.SOCKS4,
host=proxy['host'],
port=int(proxy['port']),
username=proxy.get('user', None),

Loading…
Cancel
Save