Fix tarball download function.
We were using Python's requests library and it was automatically uncompressing some tarballs. Switch to using raw requests to avoid that.
This commit is contained in:
parent
e0297e50c5
commit
db27ef0049
8
sysa.py
8
sysa.py
|
@ -76,8 +76,12 @@ class SysA:
|
||||||
# Actually download the file
|
# Actually download the file
|
||||||
if not os.path.isfile(abs_file_name):
|
if not os.path.isfile(abs_file_name):
|
||||||
print("Downloading: %s" % (file_name))
|
print("Downloading: %s" % (file_name))
|
||||||
request = requests.get(url, allow_redirects=True)
|
response = requests.get(url, allow_redirects=True, stream=True)
|
||||||
open(abs_file_name, 'wb').write(request.content)
|
if response.status_code == 200:
|
||||||
|
with open(abs_file_name, 'wb') as target_file:
|
||||||
|
target_file.write(response.raw.read())
|
||||||
|
else:
|
||||||
|
raise Exception("Download failed.")
|
||||||
|
|
||||||
# Check SHA256 hash
|
# Check SHA256 hash
|
||||||
self.check_file(abs_file_name)
|
self.check_file(abs_file_name)
|
||||||
|
|
Loading…
Reference in New Issue