def DownloadFile(SaveLoc,DownloadURL,Item): (dirParent, filename) = os.path.split(SaveLoc) try: os.makedirs(dirParent) except: pass if(os.path.exists(SaveLoc)): os.remove(SaveLoc) with tqdm(unit='B', unit_scale=True, leave=True, miniters=1, desc=Item) as t: urllib.urlretrieve(DownloadURL,SaveLoc , reporthook=my_hook(t)) print("\n")
def DownloadZip(SaveLoc,DownloadURL,Item,Canskip=True): # print("Preparing to download - "+ Item) (dirParent, filename) = os.path.split(SaveLoc) try: os.makedirs(dirParent) except: pass skip = isZip(SaveLoc) if not Canskip: skip = False if not skip: if os.path.exists(SaveLoc): os.remove(SaveLoc) with tqdm(unit='B', unit_scale=True, leave=True, miniters=1, desc=Item) as t: urllib.urlretrieve(DownloadURL,SaveLoc , reporthook=my_hook(t)) # sys.stdout.flush() else: print("Fetching "+Item+" - SKIPPED") print("\n")