📜  如何恢复请求下载 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:31.954000             🧑  作者: Mango

代码示例1
resume_header = {'Range':f'bytes={path('filename.zip').stat().st_size}-'}
r = requests.get(url,stream=True, headers=resume_header)
with open ('filename.zip','ab') as f: # keep 'ab' in mind
   for chunk in r.iter_content(chunk-size=1024):
     f.write(chunk)