diff --git a/setup.py b/setup.py index e0b4c90e2382..5d8486dc9a20 100644 --- a/setup.py +++ b/setup.py @@ -275,6 +275,7 @@ def build_extensions(self): python_requires='>={}'.format('.'.join(str(n) for n in min_version)), setup_requires=[ + "certifi>=2020.06.20", "numpy>=1.15", ], install_requires=[ diff --git a/setupext.py b/setupext.py index 1be0e744f7b5..a8a0ae7cdde7 100644 --- a/setupext.py +++ b/setupext.py @@ -42,6 +42,13 @@ def _get_hash(data): return hasher.hexdigest() +@functools.lru_cache() +def _get_ssl_context(): + import certifi + import ssl + return ssl.create_default_context(cafile=certifi.where()) + + def download_or_cache(url, sha): """ Get bytes from the given url or local cache. @@ -73,7 +80,8 @@ def download_or_cache(url, sha): # default User-Agent, but not (for example) wget; so I don't feel too # bad passing in an empty User-Agent. with urllib.request.urlopen( - urllib.request.Request(url, headers={"User-Agent": ""})) as req: + urllib.request.Request(url, headers={"User-Agent": ""}), + context=_get_ssl_context()) as req: data = req.read() file_sha = _get_hash(data)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: