Compare commits

..

No commits in common. "9a4fb87d44065223522947698abcba4f398731be" and "c1ce90d1ce101fe6cf323ea377d5745fad2afe21" have entirely different histories.

1 changed files with 7 additions and 5 deletions

View File

@ -122,18 +122,20 @@ def main() -> None:
try: try:
with urllib.request.urlopen(req) as response: with urllib.request.urlopen(req) as response:
download(url, response, output) download(url, response, output)
except urllib.error.URLError as e: except urllib.error.URLError:
if str(e).find("CERTIFICATE_VERIFY_FAILED") == -1:
return
try: try:
import certifi import certifi
import ssl import ssl
except: except:
print("\"certifi\" module not found. Please install it using \"python -m pip install certifi\".") import sys
return import subprocess
curr_py = sys.executable
subprocess.check_call([curr_py, '-m', 'pip', 'install', 'certifi', 'ssl'], stdout=subprocess.DEVNULL)
with urllib.request.urlopen(req, context=ssl.create_default_context(cafile=certifi.where())) as response: with urllib.request.urlopen(req, context=ssl.create_default_context(cafile=certifi.where())) as response:
download(url, response, output) download(url, response, output)
if __name__ == "__main__": if __name__ == "__main__":
main() main()