examples/network: Use SSLContext instead of old ssl.wrap_socket.
`ssl.wrap_socket()` is deprecated in CPython, so use `SSLContext` instead, so the example is a good example to copy. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
c8385ef75a
commit
d75705311a
@ -32,7 +32,10 @@ def main(domain, addr_family=0, use_stream=True):
|
||||
s.connect(addr)
|
||||
|
||||
# Upgrade the socket to a TLS connection.
|
||||
s = ssl.wrap_socket(s)
|
||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
s = ctx.wrap_socket(s)
|
||||
print(s)
|
||||
|
||||
# Send request and read response.
|
||||
|
Loading…
Reference in New Issue
Block a user