首页 文章

机器人框架-API呼叫

提问于
浏览
1

我有运行WGET的python代码来运行API(Get \ Post,ETC)

我想对ROBOT做同样的事情,但可能有语法问题 .

我运行api的python代码:

APIWGET = [WGETInstallationFolder,"--post-data="+PostFile,"--output-file="+TempReadWritePath + 'TempReadWriteFile' + TimeNow + '.txt',"--wait=2","--content-on-error", "--header="+HeaderTokenAdmin1+TokenToVar,"--header="+Header, "--output-document="+TempReadWritePath + 'TempReadWriteFile' + TimeNow + '.txt',"--timeout=3","--tries=3", "--save-headers", "http://" + BEIP +":8080/lms/v1/components"]

我想发帖json:{“type”:“IDU”,“serial_number”:“00000000601C7898”}'我想使用 Headers :auth-token:abcde1111&Content-Type:application / json

我正在使用Windows上的骑行,并试图使用“请求”lib中的post关键字

请参阅随附的屏幕截图描述我做了什么[Image with Ride screenshot]

1 回答

  • 1

    希望这个例子可以帮助你:

    ${auth}    Create List    <username>    <password>
    Create Session    my_session    <URL>    auth=${auth}
    ${headers}    Create Dictionary    Accept    application/json    Content-Type    application/json
    ${resp}    POST    my_session    <your rest api>    data=<JSON DATA>    headers=${headers}
    

相关问题