如何在接口中下载PDF
Py文件
import time import requests # 拼接headers数据 headers = { 'Content-Type':'application/x-msdownload;charset=UTF-8', } headers['cl-auth'] = env_dict['Authorization'] url = "http://static.cninfo.com.cn/finalpage/2021-04-17/1209711009.PDF" results = requests.post(req_url,json=yaml_case['body'],headers=headers, verify=False) if results.status_code == 200: with open(r"E:\pdf文档\%s.pdf" % name, "wb") as code: code.write(results.content) time.sleep(5) # 防止访问速度过快,可以灵活的调整时间
本文来自博客园,作者:他还在坚持嘛,转载请注明原文链接:他还在坚持嘛 https://www.cnblogs.com/brf-test/p/16847569.html