
介面資訊
-
介面地址:http://xxx.xxx.xxx.xxx:8010/xxx/upload
-
請求方法:POST
-
請求型別:Content-Type: multipart/form-data
請求引數:

回應型別:Content-Type:application/json,
回應內容:

回傳引數示例:
{ "ret":1, "msg":"獲取資料成功", "content":[] }
(左右滑動查看完整代碼)
Postman實作檔案上傳
(1)header中,指明Content-Type為multipart/form-data,

(2)body選擇form-data,填寫引數名和引數值,
注意:檔案型別的引數要選擇file后直接上傳檔案,

requests模塊實作檔案上傳
(1)放在前面說明,requests模塊傳參有四種方式:params、data、json和files,
-
parmas:傳遞查詢字串引數(常用于get請求),
-
data:傳遞表單型別的引數(Content-Type為application/x-www-form-urlencoded),
-
json:傳遞json型別的引數(Content-Type為application/json),
-
files:用于上傳檔案(Content-Type為multipart/form-data;)
(2)檔案的引數使用files,其他的引數使用data,

(3)執行python檔案即可,

httprunner實作檔案上傳
(1)通過upload傳遞引數,包括檔案引數和其他引數,
注意:所有引數值都必須為字串型別,
(2)api檔案,

(3)testcases檔案,

(4)通過hrun testcase_name.yml執行即可,

End
https://mp.weixin.qq.com/s/siyRalMN_l1mogiDqPL8aw
免費資料復制上方鏈接至瀏覽器領取
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/403948.html
標籤:其他
下一篇:【Android 教程系列第 28 篇】Android 分別使用 jarsigner 和 apksigner 對 APK 簽名(v1、v2 簽名)的詳細教程
