Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssl证书会导致代码失败,还有526错误,所以强制ssl不验证,并且失败程序不会中断。 #192

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
12 changes: 10 additions & 2 deletions download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import json
import urllib.request

import ssl

from concurrent.futures import ThreadPoolExecutor, wait

root = os.path.dirname(os.path.abspath(
Expand All @@ -29,10 +31,16 @@ def generate_sha256(file):
sha256.update(data)
return sha256.hexdigest()

ssl._create_default_https_context = ssl._create_unverified_context

def download(identifier, url, file):
print(f'Downloading {identifier} game file')
urllib.request.urlretrieve(url, file)
try:
print(f'Downloading {identifier} game file')
result = urllib.request.urlretrieve(url, file)
print(result)
print(f'DownloadSuccess')
except urllib.error.HTTPError as e:
print("Fail:"+str(e))


def main(prefix=PREFIX, destination=DESTINATION):
Expand Down