*** Settings ***
Library           RequestsLibrary
Resource          res_zmx.resource

*** Keywords ***
GET请求结果
    [Arguments]    ${PATH}    ${par_json}    ${status_code}=200    ${token}=${token}
    ${params}    参数生成    ${par_json}
    ${content}    GET请求    ${PATH}    ${params}    ${token}    ${status_code}
    [Return]    ${content}

POST请求结果
    [Arguments]    ${PATH}    ${par_json}    ${status_code}=200    ${token}=${token}
    ${params}    参数生成    ${par_json}
    ${content}    POST请求    ${PATH}    ${params}    ${token}    ${status_code}
    [Return]    ${content}

POST请求结果_params
    [Arguments]    ${PATH}    ${par_json}    ${status_code}=200    ${token}=${token}
    ${params}    参数生成    ${par_json}
    ${content}    POST请求_params    ${PATH}    ${params}    ${token}    ${status_code}
    [Return]    ${content}

PUT请求结果_json
    [Arguments]    ${PATH}    ${par_json}    ${status_code}=200    ${token}=${token}
    ${params}    参数生成    ${par_json}
    ${content}    PUT请求_json    ${PATH}    ${params}    ${token}    ${status_code}
    [Return]    ${content}

PUT请求结果_params
    [Arguments]    ${PATH}    ${par_json}    ${status_code}=200    ${token}=${token}
    ${params}    参数生成    ${par_json}
    ${content}    PUT请求_params    ${PATH}    ${params}    ${token}    ${status_code}
    [Return]    ${content}

DEL请求结果
    [Arguments]    ${PATH}    ${par_json}    ${status_code}=200    ${token}=${token}
    ${params}    参数生成    ${par_json}
    ${content}    DEL请求    ${PATH}    ${params}    ${token}    ${status_code}
    [Return]    ${content}

POST附件请求
    [Arguments]    ${file_name}    ${path}    ${status_code}=200    ${token}=${token}
    ${file1}    Evaluate    (r'${file_name}', open(r'${CURDIR}${/}files_joe${/}${file_name}', 'rb'))
    &{files}    Create Dictionary    file=${file1}
    &{header}    Create Dictionary    Authorization=${token}
    ${resp}    Post On Session    URI    ${path}    files=${files}    headers=${header}    expected_status=${status_code}
    ${content}    Set Variable    ${resp.json()}
    [Return]    ${content}

机器人GET请求结果
    [Arguments]    ${PATH}    ${par_json}    ${status_code}=200    ${token}=${robot_token}
    ${params}    参数生成    ${par_json}
    ${content}    机器人GET请求    ${PATH}    ${params}    ${token}    ${status_code}
    [Return]    ${content}
