request接口上传附件
抓到页面请求可以看到这些,使用files,cookie省略,根据实际情况添加
import requests url = "https://www.***.com/uploadExcel.json" # => 打开上传文件并且加入文件相关参数 file = { 'excel': open(r'C:\Users\Administrator\Desktop\test.xls', 'rb'), 'Content-Disposition': 'form-data', 'Content-Type': 'application/vnd.ms-excel', 'filename':'test.xls' } response = requests.request("POST", url,files=file) print(response.text)
本文来自博客园,作者:OTAKU_nicole,转载请注明原文链接:https://www.cnblogs.com/nicole-zhang/p/14845172.html