WIP: Project Tools: Remove Requests Module from studio scripts #279
@ -2,9 +2,8 @@
|
||||
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
from urllib.request import urlretrieve
|
||||
from urllib.request import urlretrieve, urlopen
|
||||
import sys
|
||||
import requests
|
||||
import glob
|
||||
import os
|
||||
|
||||
@ -23,7 +22,7 @@ def update_blender_studio_addons(download_folder_path: Path):
|
||||
url_zip = "https://projects.blender.org/studio/blender-studio-pipeline/releases/download/latest/blender_studio_add-ons_latest.zip"
|
||||
|
||||
# Check current sha and early return if match
|
||||
web_sha = requests.get(url_sha).text.strip().lower()
|
||||
web_sha = urlopen(url_sha).read().decode()
|
||||
if sha_file.exists() & zip_file.exists():
|
||||
if shasum_matches(zip_file, web_sha):
|
||||
print(f"{zip_file.name} already up to date, canceling update")
|
||||
@ -67,13 +66,7 @@ def download_file(url, out_folder, filename):
|
||||
for file in prev_downloaded_files:
|
||||
os.remove(file)
|
||||
|
||||
# NOTE the stream=True parameter below
|
||||
with requests.get(url, stream=True) as r:
|
||||
r.raise_for_status()
|
||||
with open(local_filename, 'wb') as f:
|
||||
for chunk in r.iter_content(chunk_size=None):
|
||||
if chunk:
|
||||
f.write(chunk)
|
||||
urlretrieve(url, str(local_filename))
|
||||
|
||||
local_hash_filename = local_filename.with_suffix(".zip.sha256")
|
||||
with open(local_filename, "rb") as f:
|
||||
|
Loading…
Reference in New Issue
Block a user