def download_url(url, dest_path):
"""
Download a file to a destination path given a URL
"""
name = url.rsplit('/')[-1]
dest = dest_path + "/" + name
try:
response = urllib.request.urlopen(url)
except (urllib.error.HTTPError, urllib.error.URLError):
return False
with open(dest, 'wb') as f:
shutil.copyfileobj(response, f)
return True
# ----------------------------------------------------------
#
# CI UTILS
#
# -----------------------------------------------------------
评论列表
文章目录