Suppress SSL verification, fixes #1115

This commit is contained in:
Cheng Zhao 2015-02-10 17:52:33 +08:00
Родитель 778078973b
Коммит bedd0a11ba
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -4,6 +4,7 @@ import atexit
import contextlib import contextlib
import errno import errno
import shutil import shutil
import ssl
import subprocess import subprocess
import sys import sys
import tarfile import tarfile
@ -45,6 +46,9 @@ def scoped_env(key, value):
def download(text, url, path): def download(text, url, path):
safe_mkdir(os.path.dirname(path)) safe_mkdir(os.path.dirname(path))
with open(path, 'wb') as local_file: with open(path, 'wb') as local_file:
if hasattr(ssl, '_create_unverified_context'):
ssl._create_default_https_context = ssl._create_unverified_context
web_file = urllib2.urlopen(url) web_file = urllib2.urlopen(url)
file_size = int(web_file.info().getheaders("Content-Length")[0]) file_size = int(web_file.info().getheaders("Content-Length")[0])
downloaded_size = 0 downloaded_size = 0