if content size changed, the file will be redownloaded

This commit is contained in:
raphael60650 2021-06-17 18:34:27 +02:00
parent 524104b400
commit d65e932928

View file

@ -6,8 +6,10 @@ root = "https://raw.githubusercontent.com/Faraphel/MKWF-Install/master/"
def get_github_file(self, file):
try:
if os.path.exists(file): return 1
dl = requests.get(root+file, allow_redirects=True, stream=True)
if os.path.exists(file):
if int(dl.headers['Content-Length']) == os.path.getsize(file):
return 1
if dl.status_code == 200: # if page is found
with open(file, "wb") as file: