bundled python on osx fails with ssl._create_default_https_context

This commit is contained in:
j 2015-02-23 02:12:43 +05:30
parent 14098e3c01
commit d5988bb292

View file

@ -25,9 +25,15 @@ class FingerprintHTTPSConnection(http.client.HTTPSConnection):
self._fingerprint = fingerprint self._fingerprint = fingerprint
if self._fingerprint: if self._fingerprint:
check_hostname = False check_hostname = False
context = ssl._create_default_https_context() # dont fial for older verions of python
context.check_hostname = False # without ssl._create_default_https_context
context.verify_mode = ssl.CERT_NONE # 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, http.client.HTTPSConnection.__init__(self, host, port,
check_hostname=check_hostname, context=context, **kwargs) check_hostname=check_hostname, context=context, **kwargs)