I want to test API using Requests Library.
My Code is as follows:
*** Settings ***
Documentation Read API Testcase
Library RequestsLibrary
*** Variables ***
${headers} {'content-type': 'application/json', 'authorizationFlag':'N'}
*** Test Cases ***
Read API
Create Session CLM http://172.20.33.224:8080/clm-reg/rest/dataservice/1/CLM/1
${resp} Get Request CLM /RegistrationRequestDetails/json/583d8b14498e021b2f93a773 headers = ${headers}
Log to console ${resp}
I am getting the error :
AttributeError: 'unicode' object has no attribute 'items'
I found the problem with the Headers i am passing.
when i searched over the internet, i got that the way i am passing the header values is correct.
Please any one help me on this.
Thanks Sarada
The problem is that your ${headers}
var is just a string, not a dictionary.
JSON is tricky that way. You have several options to create a dictionary in RF.
Create Dictionary
keywordjson.loads(str)
as a lib callEvaluate
keyword...