Skip to content

Commit

Permalink
Python 3.12 ssl compatibility fix (#57)
Browse files Browse the repository at this point in the history
* Add sg file

* Revert "Add sg file"

This reverts commit 726298c.

* Python 3.12 ssl compatibility fix
  • Loading branch information
chkp-edenbr authored Nov 27, 2023
1 parent 325c7a7 commit 2f471a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cpapi/mgmt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,8 @@ def read_fingerprint_from_file(server, filename="fingerprints.txt"):
return ""

def create_https_connection(self):
context = ssl.create_default_context()
context.check_hostname = True
context = ssl.SSLContext(protocol=ssl.PROTOCOL_TLS)
context.verify_mode = ssl.CERT_NONE
# create https connection
if self.proxy_host and self.proxy_port:
conn = HTTPSConnection(self.proxy_host, self.proxy_port, context=context)
Expand Down Expand Up @@ -784,7 +784,7 @@ class HTTPSConnection(http_client.HTTPSConnection):
"""
def connect(self):
http_client.HTTPConnection.connect(self)
self.sock = ssl.wrap_socket(self.sock, self.key_file, self.cert_file, cert_reqs=ssl.CERT_NONE)
self.sock = self._context.wrap_socket(self.sock, server_hostname=self.host)

def get_fingerprint_hash(self):
if self.sock is None:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="cp-mgmt-api-sdk",
version="1.7.0",
version="1.8.0",
author="API team",
author_email="[email protected]",
license='Apache 2.0',
Expand Down

0 comments on commit 2f471a7

Please sign in to comment.