basic auth in rest api using robot framework

2,171 views
Skip to first unread message

Srikanth Gattupalli

unread,
Sep 27, 2019, 7:43:15 AM9/27/19
to robotframework-users
Hi,

I am new to robot framework requests library. When i started exploring more about the API's, there were lot of examples shared which doesnt require authentication. Could someone share the references or sample code for basic auth in robot framework.

Thanks in Advance!!!

Anthony fromtheuk

unread,
Sep 27, 2019, 8:35:06 AM9/27/19
to robotframework-users

Anthony fromtheuk

unread,
Sep 27, 2019, 8:43:12 AM9/27/19
to robotframework-users
Something like so for bearer token...
*** Variables ***
${headers} Create Dictionary Authorization=“Bearer abcde”


*** Test Cases ***
Make a simple REST API call
[Tags] API
Create Session my_json http://localhost:3000
Log ${headers}
${response} = Get Request my_json /posts headers=${headers}
Log ${response}
Reply all
Reply to author
Forward
0 new messages