files
KOS_qrcodes/_tools/lib/network.py
Magomed Kostoev (mkostoevr) 460c5f6329 [WS] Move download_if_exist to lib
git-svn-id: svn://kolibrios.org@9382 a494cfbc-eb01-0410-851d-a64ba20cac60
2021-12-04 09:59:17 +00:00

14 lines
292 B
Python

import os
import urllib.request
from .logging import log
def download(link, path):
log(f"Downloading {path}... ", end = "")
urllib.request.urlretrieve(link, path)
log("Done.")
def download_if_not_exist(link, path):
if not os.path.exists(path):
download(link, path)