Browse Source

interface: fix DeprecationWarnings re SSLContext

```
...\electrum\electrum\interface.py:585: DeprecationWarning: ssl.SSLContext() without protocol argument is deprecated.
  sslc = ssl.SSLContext()
...\electrum\electrum\interface.py:585: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
  sslc = ssl.SSLContext()
```
patch-4
SomberNight 3 years ago
parent
commit
4915db52b9
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/interface.py

8
electrum/interface.py

@ -495,8 +495,8 @@ class Interface(Logger):
sslc = ca_sslc
else:
# pinned self-signed cert
sslc = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, cafile=self.cert_path)
sslc.check_hostname = 0
sslc = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=self.cert_path)
sslc.check_hostname = False
return sslc
def handle_disconnect(func):
@ -582,7 +582,9 @@ class Interface(Logger):
raise GracefulDisconnect("could not get certificate after 10 tries")
async def _fetch_certificate(self) -> bytes:
sslc = ssl.SSLContext()
sslc = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS_CLIENT)
sslc.check_hostname = False
sslc.verify_mode = ssl.CERT_NONE
async with _RSClient(session_factory=RPCSession,
host=self.host, port=self.port,
ssl=sslc, proxy=self.proxy) as session:

Loading…
Cancel
Save