Optimizing code (wrap_socket())
Since Python 3.2 and 2.7.9, it is recommended
to use the SSLContext.wrap_socket() instead of
wrap_socket().
The top-level function is limited and creates an
insecure client socket without server name
indication or hostname matching.
Ref
@@ -114,7 +114,7 @@ class DS8KHTTPSConnection(connection.VerifiedHTTPSConnection):
# Wrap socket using verification with the root certs in
# trusted_root_certs
- self.sock = ssl.wrap_socket(conn)
+ self.sock = ssl.SSLContext.wrap_socket(conn)
self._verify_cert(self.sock, self.ca_certs)
self.is_verified = True
