0

The Get, Get request key words in requests library documentation does not provide any examples where user credentials/AUTH_TOKEN and other arguments passed in the API call.

6
  • 1
    which robotframework library are you using? Also, have you done any research before asking? Assuming you're using RequestsLibrary, there are lots of examples in its own test suite. github.com/bulkan/robotframework-requests/blob/master/tests/… Commented Mar 29, 2018 at 14:39
  • Thanks Bryan. I ran test using the first example from the link you posted and I get error No keyword with name 'Create Session' found. No keyword with name 'Delete All Sessions' found. I am quite new to this framework and honestly this is the first test I am trying out in this framework. Commented Mar 29, 2018 at 15:49
  • Please tell us which robot library you're using. It sounds like you're not using RequestsLibrary. Commented Mar 29, 2018 at 16:22
  • I am using both Collections and RequestsLibrary. Commented Mar 29, 2018 at 16:42
  • 1
    Then you're doing something wrong if you're getting an error about Create Session not found, since that keyword is created by that library. Please provide a minimal reproducible example. Commented Mar 29, 2018 at 16:44

1 Answer 1

2

As Bryan pinted, the examples are in the libraries tests.

For basic authentification, there is:

Get With Auth
   [Tags]  get     get-cert
   ${auth}=  Create List  user   passwd
   Create Session    httpbin    https://httpbin.org     auth=${auth}   verify=${CURDIR}${/}cacert.pem
   ${resp}=  Get Request  httpbin  /basic-auth/user/passwd
   Should Be Equal As Strings  ${resp.status_code}  200
   Should Be Equal As Strings ${resp.json()['authenticated']} True

If you get No keyword with name 'Create Session' found., that means that you are not importing the library correctly or not having it installed correctly.

If you just running the testcase.txt, wrong import is the most like reason. It imports the keywords directly from the source file in author's local repository, instead of installed library package:

Library ../src/RequestsLibrary/RequestsKeywords.py

Instead, import it like in the examples in the librarie's GIT homepage/readme.MD

Library     RequestsLibrary

If there is issue with installation, just do:

pip install -U requests
pip install -U robotframework-requests
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Jan and Bryan - The issue was with the Library installation on our network. I had to re-install out-side-of my office network for a successful install.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.