代码之家  ›  专栏  ›  技术社区  ›  P S

使用OAuth2的API上的RequestsLibrary

  •  0
  • P S  · 技术社区  · 7 年前

    我试图在使用OAUTH2身份验证的API上使用RequestsLibrary,但每次都抛出400=200

    Get authToken
    
        Create Session   test   http://brentertainment.com/oauth2/
        ${data}=      Create Dictionary     grant_type= 'password'      client_id=demoapp     client_secret=demopass      username= 'demouser'   password='testpass'
        ${headers}=     Create Dictionary   Content-Type= 'application/x-www-form-urlencoded'
        ${resp}=  post request     test     /lockdin/token     ${headers}     ${data}
        Should Be Equal As Strings  ${resp.status_code}     200
    

    任何帮助都将不胜感激。

    1 回复  |  直到 7 年前
        1
  •  0
  •   P S    7 年前

    我使用了扩展请求库而不是请求库

    *** Settings ***
    Library    ExtendedRequestsLibrary
    
    *** Test Cases ***
    Post Request With Password
    
        Create Password OAuth2 Session    member    http://token     client_id    client_secret    username   password    scope   base_url
        ${var} =  get request        member    /abc
        Log    ${var.content}