Skip to content

Commit 2f471a7

Browse files
authored
Python 3.12 ssl compatibility fix (#57)
* Add sg file * Revert "Add sg file" This reverts commit 726298c. * Python 3.12 ssl compatibility fix
1 parent 325c7a7 commit 2f471a7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cpapi/mgmt_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,8 @@ def read_fingerprint_from_file(server, filename="fingerprints.txt"):
748748
return ""
749749

750750
def create_https_connection(self):
751-
context = ssl.create_default_context()
752-
context.check_hostname = True
751+
context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
752+
context.verify_mode = ssl.CERT_NONE
753753
# create https connection
754754
if self.proxy_host and self.proxy_port:
755755
conn = HTTPSConnection(self.proxy_host, self.proxy_port, context=context)
@@ -784,7 +784,7 @@ class HTTPSConnection(http_client.HTTPSConnection):
784784
"""
785785
def connect(self):
786786
http_client.HTTPConnection.connect(self)
787-
self.sock = ssl.wrap_socket(self.sock, self.key_file, self.cert_file, cert_reqs=ssl.CERT_NONE)
787+
self.sock = self._context.wrap_socket(self.sock, server_hostname=self.host)
788788

789789
def get_fingerprint_hash(self):
790790
if self.sock is None:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name="cp-mgmt-api-sdk",
6-
version="1.7.0",
6+
version="1.8.0",
77
author="API team",
88
author_email="[email protected]",
99
license='Apache 2.0',

0 commit comments

Comments
 (0)