需要通过robot框架发出POST请求

需要通过robot框架发出POST请求,post,robotframework,Post,Robotframework,我是机器人框架的新手,我需要通过机器人框架发出POST请求。我能够通过postman工具成功运行post请求。下面是我通过postman工具生成的curl命令: curl -X POST \ http://ip:port/ai/data/upload \ -H 'content-type: multipart/form-data \ -F 'fileData=@C:\Users\xyz\Desktop\report.html' \ -F clientId=client \ -

我是机器人框架的新手,我需要通过机器人框架发出POST请求。我能够通过postman工具成功运行post请求。下面是我通过postman工具生成的curl命令:

curl -X POST \
  http://ip:port/ai/data/upload \
  -H 'content-type: multipart/form-data \
  -F 'fileData=@C:\Users\xyz\Desktop\report.html' \
  -F clientId=client \
  -F subClientId=test \
  -F fileType=compliance

有人能帮我解决机器人的上述卷曲要求吗

正如Alex所说,你想看看

或者

将命令(curl…)存储在command.sh文件中,然后通过进程库执行此command.sh文件

代码:

*** Settings ***
Library    Process
*** Variables ***
*** Test cases ***
Test Requests
    test process
*** Keywords ***
test process
    ${handle}=    Start Process    command.sh     #make sure your robotfile and command.sh is in same directory or give path till sh file

使用Robot请求图书馆

以下是多部分文件上传案例的相关链接

试试这个:

*Settings*

Library  RequestsLibrary
Library  OperatingSystem

*Test Case*
Test One
  &{data}=  Create Dictionary  foo=bar
  Create File  foobar  content=foobarcontent
  &{files}=  Evaluate  {'foofile': open('foobar')}
  ${resp}=  Evaluate
  ...  requests.post('http://localhost:8000/foo', data=$data, files=$files)
  ...  modules=requests
  Log  ${resp}  console=${TRUE}
欢迎光临。预计问题符合某些标准。我强烈建议您阅读的页面中描述了这些内容。此外,我们希望您已经付出一定程度的努力。尽管您向我们提供了想要模仿的
curl
语句,但没有您尝试过的机器人框架代码。这对我来说意味着,您可能还没有在这个问题上花费足够的时间,只需要工作代码。这不是我们的目的。