aboutsummaryrefslogtreecommitdiff
path: root/update.py
diff options
context:
space:
mode:
authorAlexander Hayden <alexhayden25@gmail.com>2019-01-12 21:06:10 -0500
committerAlexander Hayden <alexhayden25@gmail.com>2019-01-12 21:06:10 -0500
commit46b47199faa816bbb7a4bdaae701c67564185cb1 (patch)
treebb2863c62ab9a8261054ebc66881186a426fb316 /update.py
parent2bcdccf0f50a982c0420d59fe4768863a296edb7 (diff)
downloadmodpackman-46b47199faa816bbb7a4bdaae701c67564185cb1.tar.gz
modpackman-46b47199faa816bbb7a4bdaae701c67564185cb1.zip
Make redirects work (fix the bork)
Diffstat (limited to 'update.py')
-rwxr-xr-xupdate.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/update.py b/update.py
index 11c6b4c..4e4dad1 100755
--- a/update.py
+++ b/update.py
@@ -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...")