*** Settings *** Library RequestsLibrary Resource ../../03-Variable/BifangApiVariable.txt Library string *** Keywords *** GetApi [Arguments] ${url} ${startTime}=${None} ${endTime}=${None} ${limit}=${None} ${statisticTime}=${None} ${statisticsUnit}=${None} ${timeGranularity}=${None} ${policy_id}=${None} ${ip}=${None} #拼接查询条件 ${strstrartTime}= run keyword if '${startTime}'!='${None}' Set Variable startTime=${startTime}& ... ELSE Set Variable ${EMPTY} ${strendTime}= run keyword if '${endTime}'!='${None}' Set Variable endTime=${endTime}& ... ELSE Set Variable ${EMPTY} ${strstatisticTime}= run keyword if '${statisticTime}'!='${None}' Set Variable statisticTime=${statisticTime}& ... ELSE Set Variable ${EMPTY} ${strlimit}= run keyword if '${limit}'!='${None}' Set Variable limit=${limit}& ... ELSE Set Variable ${EMPTY} ${strstatisticsUnit}= run keyword if '${statisticsUnit}'!='${None}' Set Variable statisticsUnit=${statisticsUnit}& ... ELSE Set Variable ${EMPTY} ${strtimeGranularity}= run keyword if '${timeGranularity}'!='${None}' Set Variable timeGranularity=${timeGranularity}& ... ELSE Set Variable ${EMPTY} ${strpolicy_id} run keyword if '${policy_id}'!='${None}' Set Variable policy_id=${policy_id}& ... ELSE Set Variable ${EMPTY} ${strip} run keyword if '${ip}'!='${None}' Set Variable ip=${ip}& ... ELSE Set Variable ${EMPTY} ${condition} catenate SEPARATOR= ${strstrartTime} ${strendTime} ${strstatisticTime} ${strlimit} ${strstatisticsUnit} ${strtimeGranularity} ${strpolicy_id} ${ip} #创建请求信息 ${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Authorization=${token} Create Session api http://${host}:${port}/${version} #发送请求 ${remoteResponse} Get Request api ${url}?${condition} headers=${header} log ${remoteResponse} ${response} to json ${remoteResponse.content} #验证请求是否成功 Should Be Equal As Strings ${remoteResponse.status_code} 200 Should Be Equal As Strings ${response}[code] 200 #请求大数据 #sql拼接 #BigData ${sql} BigData [Arguments] ${sql} #创建请求信息 Create Session api http://192.168.40.224:9999 #发送请求 ${remoteResponse} Get Request api ?query= ${sql}