zoukankan      html  css  js  c++  java
  • Python 请求requests

    *** Settings ***
    Documentation     Suite description
    Library           RequestsLibrary
    
    *** Variables ***
    
    *** Keywords ***
    Call Get Request
        [Arguments]    ${headers}    ${parameters}    ${url}    ${apiPath}    ${cookies}
        Create Session    event    ${url}
        ${response}    Get Request    event    ${apiPath}    params=${parameters}    headers=${headers}
        ${reult}     to json  ${response.content}
        log  ${reult}
        [Return]    ${response}
    
    Call Post Request
        [Arguments]    ${headers}    ${parameters}    ${url}    ${apiPath}    ${cookies}
        Create Session    event    ${url}
        ${response}    Post Request    event    ${apiPath}    params=${parameters}    headers=${headers}
        ${reult}     to json  ${response.content}
        log  ${reult}seatPlan1_1
        [Return]    ${response}
    
    Call Put Request
        [Arguments]    ${headers}    ${parameters}    ${url}    ${apiPath}    ${cookies}
        Create Session    event    ${url}    cookies=${cookies}
        ${response}    Put Request    event    ${apiPath}    params=${parameters}    headers=${headers}
        ${reult}     to json  ${response.content}
        log  ${reult}
        [Return]    ${response}
    
    Call Delete Request
        [Arguments]    ${headers}    ${parameters}    ${url}    ${apiPath}    ${cookies}
        Create Session    event    ${url}
        ${response}    Delete Request    event    ${apiPath}    params=${parameters}    headers=${headers}
        ${reult}     to json  ${response.content}
        log  ${reult}
        [Return]    ${response}
    
    Call Post JSON Request
        [Arguments]    ${headers}    ${parameters}    ${url}    ${apiPath}    ${cookies}
        Create Session    event    ${url}
        ${response}    Post Request    event    ${apiPath}    data=${parameters}    headers=${headers}
        ${reult}     to json  ${response.content}
        log  ${reult}
        [Return]    ${response}
    

      

  • 相关阅读:
    O052、Create Volume 操作 (Part III)
    O051、Create Volume 操作 (Part II)
    O050、Create Volume 操作 (Part I)
    O049、准备 LVM Volume Provider
    O048、掌握 cinder-scheduler 调度逻辑
    O047、 Cinder 组件详解
    O046、掌握Cinder 的设计思想
    O045、理解 Cinder 架构
    O044、一张图秒懂 Nova 16种操作
    O043、计算节点宕机了怎么办
  • 原文地址:https://www.cnblogs.com/qianjinyan/p/12464535.html
Copyright © 2011-2022 走看看