Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backport PR #18225 on branch v3.3.x (Use certifi when downloading bundled build requirements.)#18230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionssetup.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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=[
Expand Down
10 changes: 9 additions & 1 deletionsetupext.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
Expand DownExpand Up@@ -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)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp