From fe86f911100aeec1f3d5afcfdb5da1babbe4d98f Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 13 Apr 2020 05:00:26 +0200 Subject: [PATCH] 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__( --- electrum/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/electrum/util.py b/electrum/util.py index 5a302d3c3..cd08c1e99 100644 --- a/electrum/util.py +++ b/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),