fix download_tool.py
This commit is contained in:
parent
106c158b75
commit
c9f9191fea
3 changed files with 71 additions and 12 deletions
|
|
@ -20,6 +20,8 @@ import urllib.request
|
|||
import zipfile
|
||||
from typing import Callable, Dict
|
||||
from pathlib import Path
|
||||
import certifi
|
||||
import ssl
|
||||
|
||||
|
||||
def binutils_url(tag):
|
||||
|
|
@ -104,7 +106,7 @@ def main() -> None:
|
|||
|
||||
print(f"Downloading {url} to {output}")
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
with urllib.request.urlopen(req) as response:
|
||||
with urllib.request.urlopen(req, context=ssl.create_default_context(cafile=certifi.where())) as response:
|
||||
if url.endswith(".zip"):
|
||||
data = io.BytesIO(response.read())
|
||||
with zipfile.ZipFile(data) as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue