问题:移动端自动化需要安装apk文件,需要从网站下载,过程中记录下,代码如下
url = 'XXXXXXXXX' ret = requests.get(url, allow_redirects=False, verify=False) apkurl = ret.headers['Location'] apk_res = requests.get(apkurl, stream=True, verify=False) with open('11.apk','wb') as f: for chunk in apk_res.iter_content(chunk_size=1024): if chunk: f.write(chunk)
注释:chunk_size表示下载的流量大小