change from requests to urllib
parent
6a3cd9a52d
commit
62b78ff182
|
@ -1,15 +1,9 @@
|
||||||
import requests, datetime, os
|
import datetime, os, urllib
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def download_backup(backup_url: str, file_path: str):
|
def download_backup(backup_url: str, file_path: str):
|
||||||
r = requests.get(backup_url, stream = True)
|
urllib.request.urlretrieve(backup_url, file_path)
|
||||||
|
|
||||||
with open(file_path,"wb") as pdf:
|
|
||||||
for chunk in r.iter_content(chunk_size=1024):
|
|
||||||
|
|
||||||
if chunk:
|
|
||||||
pdf.write(chunk)
|
|
||||||
|
|
||||||
|
|
||||||
def create_dirs_and_download(backup_url: str, date: datetime.datetime, base_path: str) -> str:
|
def create_dirs_and_download(backup_url: str, date: datetime.datetime, base_path: str) -> str:
|
||||||
|
|
Loading…
Reference in New Issue