download-large-file-in-python-with-requests

    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')

 

上一篇:LINE阅读笔记


下一篇:task 03 集成模式