Various fixes from rebase

This took a while so a bunch of stuff got broken in rebase.
This commit is contained in:
fosslinux 2022-05-23 15:56:18 +10:00
parent b614b3021d
commit 25f37ba926
28 changed files with 196 additions and 90 deletions

View file

@ -95,13 +95,16 @@ this script the next time")
os.mkdir(self.cache_dir)
# Actually download the file
headers = {
"Accept-Encoding": "identity"
}
if not os.path.isfile(abs_file_name):
print(f"Downloading: {file_name}")
response = requests.get(url, allow_redirects=True, stream=True)
response = requests.get(url, allow_redirects=True, stream=True,
headers=headers)
if response.status_code == 200:
with open(abs_file_name, 'wb') as target_file:
for chunk in response.iter_content(chunk_size=None):
target_file.write(chunk)
target_file.write(response.raw.read())
else:
raise Exception("Download failed.")