added a check if file is already downloaded

This commit is contained in:
raphael60650 2021-06-17 16:24:42 +02:00
parent 45c2dd7d04
commit 86d718d501

View file

@ -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