target might be in current folder
This commit is contained in:
parent
02458e86ec
commit
bab08369b9
1 changed files with 2 additions and 1 deletions
|
@ -113,6 +113,7 @@ get_url = read_url
|
||||||
def save_url(url, filename, overwrite=False):
|
def save_url(url, filename, overwrite=False):
|
||||||
if not os.path.exists(filename) or overwrite:
|
if not os.path.exists(filename) or overwrite:
|
||||||
dirname = os.path.dirname(filename)
|
dirname = os.path.dirname(filename)
|
||||||
|
if dirname:
|
||||||
os.makedirs(dirname, exist_ok=True)
|
os.makedirs(dirname, exist_ok=True)
|
||||||
headers = DEFAULT_HEADERS.copy()
|
headers = DEFAULT_HEADERS.copy()
|
||||||
r = requests.get(url, headers=headers, stream=True)
|
r = requests.get(url, headers=headers, stream=True)
|
||||||
|
|
Loading…
Reference in a new issue