File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Open diff view settings
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ def build_extensions(self):
275275
276276 python_requires = '>={}' .format ('.' .join (str (n ) for n in min_version )),
277277 setup_requires = [
278+ "certifi>=2020.06.20" ,
278279 "numpy>=1.15" ,
279280 ],
280281 install_requires = [
Original file line number Diff line number Diff line change @@ -42,6 +42,13 @@ def _get_hash(data):
4242 return hasher .hexdigest ()
4343
4444
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+
4552def download_or_cache (url , sha ):
4653 """
4754 Get bytes from the given url or local cache.
@@ -73,7 +80,8 @@ def download_or_cache(url, sha):
7380 # default User-Agent, but not (for example) wget; so I don't feel too
7481 # bad passing in an empty User-Agent.
7582 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 :
7785 data = req .read ()
7886
7987 file_sha = _get_hash (data )
You can’t perform that action at this time.
0 commit comments