1.单文件上传
fiddler抓取接口请求,Inspectors->WebForms查看接口请求参数:
写成字典格式:
key对应name对应的值,这里name=‘licfile‘
value第一个是文件名称,对应filename=‘TFC-Trial-5-OJ456465-20200609.lic’
第二个是文件路径,
第三个是对应Content-Tpype类型,
request_url = "https:xxxxx"
f ={
‘licfile‘: ("TFC-Trial-5-OJ456465-20200609.lic", open("D:\TFC-Trial-5-OJ456465-20200609.lic", "rb"), "application/octet-stream")
}
R = Session.post(request_url, files=f)
print(R.status_code)
print(R.content)
2.文件+数据同时请求