File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ def build_extensions(self):
275
275
276
276
python_requires = '>={}' .format ('.' .join (str (n ) for n in min_version )),
277
277
setup_requires = [
278
+ "certifi>=2020.06.20" ,
278
279
"numpy>=1.15" ,
279
280
],
280
281
install_requires = [
Original file line number Diff line number Diff line change @@ -42,6 +42,13 @@ def _get_hash(data):
42
42
return hasher .hexdigest ()
43
43
44
44
45
+ @functools .lru_cache ()
46
+ def _get_ssl_context ():
47
+ import certifi
48
+ import ssl
49
+ return ssl .create_default_context (cafile = certifi .where ())
50
+
51
+
45
52
def download_or_cache (url , sha ):
46
53
"""
47
54
Get bytes from the given url or local cache.
@@ -73,7 +80,8 @@ def download_or_cache(url, sha):
73
80
# default User-Agent, but not (for example) wget; so I don't feel too
74
81
# bad passing in an empty User-Agent.
75
82
with urllib .request .urlopen (
76
- urllib .request .Request (url , headers = {"User-Agent" : "" })) as req :
83
+ urllib .request .Request (url , headers = {"User-Agent" : "" }),
84
+ context = _get_ssl_context ()) as req :
77
85
data = req .read ()
78
86
79
87
file_sha = _get_hash (data )
You can’t perform that action at this time.
0 commit comments