From 86d718d501cd591cb71af454cd899c5df7277f5e Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Thu, 17 Jun 2021 16:24:42 +0200 Subject: [PATCH] added a check if file is already downloaded --- source/get_github_file.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/get_github_file.py b/source/get_github_file.py index df61bbd..0268474 100644 --- a/source/get_github_file.py +++ b/source/get_github_file.py @@ -1,10 +1,14 @@ import requests +import os + 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 dl.status_code == 200: # if page is found with open(file, "wb") as file: chunk_size = 4096