sb: Update the downloader for 2.7.8 and earlier without a context.

This commit is contained in:
Chris Johns 2015-03-30 14:30:56 +11:00
parent 3237c8ee69
commit bd16849b11

View File

@ -328,9 +328,11 @@ def _http_downloader(url, local, config, opts):
try: try:
import ssl import ssl
_ssl_context = ssl._create_unverified_context() _ssl_context = ssl._create_unverified_context()
_in = urllib2.urlopen(url, context = _ssl_context)
except: except:
pass _ssl_context = None
_in = urllib2.urlopen(url, context = _ssl_context) if _ssl_context is None:
_in = urllib2.urlopen(url)
if url != _in.geturl(): if url != _in.geturl():
log.notice(' redirect: %s' % (_in.geturl())) log.notice(' redirect: %s' % (_in.geturl()))
_out = open(path.host(local), 'wb') _out = open(path.host(local), 'wb')