target might be in current folder

This commit is contained in:
j 2024-11-04 17:40:57 +00:00
parent 02458e86ec
commit bab08369b9

View file

@ -113,7 +113,8 @@ get_url = read_url
def save_url(url, filename, overwrite=False):
if not os.path.exists(filename) or overwrite:
dirname = os.path.dirname(filename)
os.makedirs(dirname, exist_ok=True)
if dirname:
os.makedirs(dirname, exist_ok=True)
headers = DEFAULT_HEADERS.copy()
r = requests.get(url, headers=headers, stream=True)
filename_tmp = filename + '~'