[utils] Using curl with redirects and retries for download_file
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import os
|
||||
import subprocess
|
||||
import six
|
||||
|
||||
|
||||
def download_file(url, dest):
|
||||
def download_file(url, dest, retries=3, retry_delay=5):
|
||||
ensure_dir(os.path.dirname(dest))
|
||||
return subprocess.call(['wget', url, '-O', dest, '--quiet']) == 0
|
||||
return subprocess.call(['curl', url, '-L', '--retry', six.text_type(retries),
|
||||
'--retry-delay', six.text_type(retry_delay),
|
||||
'-o', dest, '--silent']) == 0
|
||||
|
||||
|
||||
def unzip_file(filename, dest):
|
||||
|
||||
Reference in New Issue
Block a user