Merge pull request #722 from sabricot/disable_ssl_certs_PEP467

Fix disabling of ssl certs check with python 2.7.9/3.4.3 and sync/threaded transport
This commit is contained in:
Armin Ronacher 2016-01-13 22:44:55 +01:00
commit 8755ce3b64
1 changed files with 5 additions and 1 deletions

View File

@ -48,7 +48,11 @@ def urlopen(url, data=None, timeout=defaults.TIMEOUT, ca_certs=None,
if verify_ssl:
handlers = [ValidHTTPSHandler]
else:
handlers = []
try:
handlers = [urllib2.HTTPSHandler(
context=ssl._create_unverified_context())]
except AttributeError:
handlers = []
opener = urllib2.build_opener(*handlers)