diff options
author | Alexander Hayden <alexhayden25@gmail.com> | 2019-01-12 21:06:10 -0500 |
---|---|---|
committer | Alexander Hayden <alexhayden25@gmail.com> | 2019-01-12 21:06:10 -0500 |
commit | 46b47199faa816bbb7a4bdaae701c67564185cb1 (patch) | |
tree | bb2863c62ab9a8261054ebc66881186a426fb316 /update.py | |
parent | 2bcdccf0f50a982c0420d59fe4768863a296edb7 (diff) | |
download | modpackman-46b47199faa816bbb7a4bdaae701c67564185cb1.tar.gz modpackman-46b47199faa816bbb7a4bdaae701c67564185cb1.zip |
Make redirects work (fix the bork)
Diffstat (limited to 'update.py')
-rwxr-xr-x | update.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -1,8 +1,8 @@ #!/bin/python3 -from urllib.request import urlretrieve +from requests import get from os import listdir, remove -from shutil import rmtree +from shutil import rmtree, copyfileobj INSTALL_DIR = "" with open("pack-location.txt", "r") as f: @@ -27,7 +27,9 @@ for mod in DOWNLOADS: print("Skipping " + mod[0] + ", already up-to-date") else: print("Installing " + mod[0] + " from " + mod[1] + "...") - urlretrieve(mod[1], INSTALL_DIR + "/" + mod[0]) + download_obj = get(mod[1], stream=True) + with open(INSTALL_DIR + "/" + mod[0], "wb") as write_file: + copyfileobj(download_obj.raw, write_file) print("Done!") print("\nRemoving old versions...") |