def _http_download(url, target): # https://*.com/questions/16694907/download-large-file-in-python-with-requests with requests.get(url, stream=True) as r: r.raise_for_status() with open(target, 'wb') as f: for chunk in r.iter_content(chunk_size=8192): # If you have chunk encoded response uncomment if # and set chunk_size parameter to None. #if chunk: f.write(chunk)
解压: shutil.unpack_archive(down_file, app_work_dir, format='tar')