WIP: Project Tools: Remove Requests Module from studio scripts #279

Closed
Nick Alberelli wants to merge 4 commits from TinyNick/blender-studio-pipeline:fix/remove-request-from-update-addons into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit abd61e7fdf - Show all commits

View File

@ -5,7 +5,7 @@ import glob
import hashlib
import os
import pathlib
import requests
from urllib.request import urlretrieve, urlopen
import shutil
import json
@ -18,13 +18,7 @@ BLENDER_BRANCH = "main"
def download_file(url, out_folder):
print("Downloading: " + url)
local_filename = out_folder / url.split('/')[-1]
# 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))
return local_filename
@ -60,8 +54,8 @@ platforms_dict = {
download_info = []
branch_string = "+" + BLENDER_BRANCH
reqs = requests.get(BUILDS_INDEX)
available_downloads = json.loads(reqs.text)
reqs = urlopen(BUILDS_INDEX).read().decode()
available_downloads = json.loads(reqs)
for download in available_downloads:
if download["branch"] != BLENDER_BRANCH:
continue
@ -81,7 +75,7 @@ for info in download_info:
file_extension = platforms_dict[platform]
url = info[1]
url_sha = url + ".sha256"
sha = requests.get(url_sha).text.strip().lower()
sha = urlopen(url_sha).read().decode().strip().lower()
arch = info[2]
current_platform_file = glob.glob(f"{download_folder_path}/*{platform}.{arch}*{file_extension}")