接口请求套路
作者:互联网
*** Settings ***
Library requests
Resource resource.robot
Library Collections
Library RequestsLibrary
*** Test Cases ***
Test
${dict} Create Dictionary username liukaibin password 123456
#输出变量
log ${dict}
#创建字典
${dict2} Create Dictionary Content-Type ${heard}
log ${dict2}
${r} requests.post https://dev-ai-class-api-edu.codemao.cn/teacher/system/login headers=${dict2} json=${dict}
log ${r.json()}
Test02
Create Session url https://dev-ai-class-api-edu.codemao.cn
#赋值变量
${yy} Set Variable {"username":"liukaibin","password":"123456"}
#转换成json数组
${uu} To json ${yy}
#创建字典
${dict2} Create Dictionary Content-Type ${heard}
${resp} Post Request url /teacher/system/login headers=${dict2} json=${uu}
log ${resp.json()}
标签:请求,Dictionary,dict2,套路,Create,接口,json,dict,log 来源: https://www.cnblogs.com/kaibindirver/p/11804481.html