Fix: Incorrect SSL context#6
Open
danmastrowtrusstai wants to merge 1 commit intoMyPureCloud:masterfrom
Open
Conversation
Without this change you're unable to connect to MyPureCloud APIs
Author
def patched_create_mtls_or_ssl_context(self):
if self.ssl_context is None:
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
if self.ssl_ca_cert:
ssl_context.load_verify_locations(cafile=self.ssl_ca_cert)
else:
# If no CA certs are provided, use certifi's bundle.
try:
ssl_context.load_verify_locations(cafile=certifi.where())
except ImportError:
pass
if self.cert_file and self.key_file:
# mTLS configuration
ssl_context.load_cert_chain(certfile=self.cert_file, keyfile=self.key_file)
self.ssl_context = ssl_context
# Bind the patched method to the configuration instance
PureCloudPlatformClientV2.configuration.create_mtls_or_ssl_context = types.MethodType(
patched_create_mtls_or_ssl_context, PureCloudPlatformClientV2.configuration
)Workaround to patch the import in the meantime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without this change you're unable to connect to MyPureCloud APIs
https://docs.python.org/3/library/ssl.html#ssl.Purpose.SERVER_AUTH
@ININDevEvangelists @carnellj-genesys @PrinceNebulon