Python 函数下载 zip 文件

问题描述 投票:0回答:1

我正在尝试使用Python函数来下载zip文件

https://storage.googleapis.com/chrome-for-testing-public/122.0.6261.69/win32/chromedriver_win32.zip 
我尝试了这个,文件已下载,但损坏不完整

import os
import requests

headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'}
url = 'https://storage.googleapis.com/chrome-for-testing-public/122.0.6261.69/win32/chromedriver_win32.zip'
request = requests.get(url, stream=True, headers=headers)

zip_filename = os.path.basename(url)
with open(zip_filename, 'wb') as zfile:
    zfile.write(request.content)
python python-requests zip
1个回答
0
投票

googleapis.com 服务器已关闭,请稍候。

© www.soinside.com 2019 - 2024. All rights reserved.