python 處理form/data文件上傳


處理multipart/form-data 的java serverlet請求接口通過python實現
記住不要在頭加:"Content-Type":"multipart/form-data"不然會報錯

import requests
dt={"file":{},"message": "duotou","hashType": "md5","statMonth":"201910","version":"1","jobId":""}

url = "http://localhost/api/v1/recall/relater"


file={'file': open("./20191011.csv", 'rb')}

head={"app_id": "100031",
"seqno":"test200811230011"}
response = requests.request("POST", url, data=dt, headers=head,files=file)

print(response.text)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM