Compare commits

...

3 Commits

Author SHA1 Message Date
CreateSource 83f5568bcd
Merge 9a4fb87d44 into 065fc7b715 2024-11-23 14:12:02 -05:00
CreateSource 9a4fb87d44
Determine type of URLError 2024-11-23 14:11:44 -05:00
CreateSource b26b99e9e3
Remove auto install script 2024-11-23 13:35:03 -05:00
1 changed files with 5 additions and 7 deletions

View File

@ -122,20 +122,18 @@ 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: except urllib.error.URLError as e:
if str(e).find("CERTIFICATE_VERIFY_FAILED") == -1:
return
try: try:
import certifi import certifi
import ssl import ssl
except: except:
import sys print("\"certifi\" module not found. Please install it using \"python -m pip install certifi\".")
import subprocess return
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()