From d5988bb2923e475054e8f1e1c853151adf0dd02c Mon Sep 17 00:00:00 2001 From: j Date: Mon, 23 Feb 2015 02:12:43 +0530 Subject: [PATCH] bundled python on osx fails with ssl._create_default_https_context --- oml/ssl_request.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/oml/ssl_request.py b/oml/ssl_request.py index 0f1c161..7442534 100644 --- a/oml/ssl_request.py +++ b/oml/ssl_request.py @@ -25,9 +25,15 @@ class FingerprintHTTPSConnection(http.client.HTTPSConnection): self._fingerprint = fingerprint if self._fingerprint: check_hostname = False - context = ssl._create_default_https_context() - context.check_hostname = False - context.verify_mode = ssl.CERT_NONE + # dont fial for older verions of python + # without ssl._create_default_https_context + # that also don't check by default + try: + context = ssl._create_default_https_context() + context.check_hostname = False + context.verify_mode = ssl.CERT_NONE + except: + pass http.client.HTTPSConnection.__init__(self, host, port, check_hostname=check_hostname, context=context, **kwargs)