From 67860dc7c3e866eef413a90309ea42920c3fcd84 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 17 Apr 2026 09:00:39 -0400 Subject: [PATCH] Fix remote client operation with Python 3.12+ --- confluent_client/confluent/client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/confluent_client/confluent/client.py b/confluent_client/confluent/client.py index 7a3674ec..8630a217 100644 --- a/confluent_client/confluent/client.py +++ b/confluent_client/confluent/client.py @@ -391,8 +391,13 @@ class Command(object): cacert = None certreqs = ssl.CERT_NONE knownhosts = True - self.connection = ssl.wrap_socket(self.connection, ca_certs=cacert, - cert_reqs=certreqs) + tlsctx = ssl.create_default_context() + if certreqs == ssl.CERT_NONE: + tlsctx.check_hostname = False + tlsctx.verify_mode = certreqs + if cacert: + tlsctx.load_verify_locations(cacert) + self.connection = tlsctx.wrap_socket(self.connection, server_hostname=server) if knownhosts: certdata = self.connection.getpeercert(binary_form=True) fingerprint = 'sha512$' + hashlib.sha512(certdata).hexdigest()