python3+robot上传文件

#导入excel关键字
importUserList

[Arguments] ${param}


#${dic} Create Dictionary Content-Disposition=form-data; name="file"; filename="userlistimport.xls" Content-Type=application/vnd.ms-excel Content-Transfer-Encoding=binary

${deleteReq} post request IP:PORT /URL/url/importUserList files=${param} #headers=${header}

log ${deleteReq.content}

should be equal as strings ${deleteReq.status_code} 200
should be byte string ${deleteReq.content} 'success':true


#用例
*** Test Cases ***

#导入用户excel
importUserList
Get session

${files} evaluate {'file': ('report.xls', open(r'D:\xxxx\userlistimport.xls', 'rb'), 'application/vnd.ms-excel')}

importUserList ${files}
原文地址:https://www.cnblogs.com/zyy98877/p/13024868.html