Groups
Groups
Sign in
Groups
Groups
robotframework-users
Conversations
About
Send feedback
Help
The error message is AttributeError: 'str' object has no attribute 'items' for Post Request
703 views
Skip to first unread message
Prakash Samal
unread,
Oct 22, 2021, 4:09:03 AM
10/22/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to robotframework-users
Hi,
PFA below code:
*** Settings ***
Library
RequestsLibrary
Library
JSONLibrary
Library
Collections
*** Variables ***
${Base_Url}
=
http://restapi.demoqa.com/customer
*** Test Cases ***
Create new resource
create session
adddata
${Base_Url}
${body}
= create dictionary
First_Name=Prakash Last_Name=Samal DOB=01/05/1993
${header}
= create dictionary
Content-Type=pplication/json
${response}
= POST On Session
adddata /register data=
${body}
headers=
${header}
log to console ${response.status_code}
log to console ${response.content}
Note: I am getting an
AttributeError: 'str' object has no attribute 'items
Please let me know what needs to be done?
Regards,
Prakash
Craig Despeaux
unread,
Oct 22, 2021, 10:47:45 AM
10/22/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to robotframework-users
Don't know if this is what's causing your problem, but ${header} is missing the a in application/json.
I don't really see another issue based on what you've provided.
Craig
Craig Despeaux
unread,
Oct 22, 2021, 11:17:21 AM
10/22/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to robotframework-users
Another thought.. perhaps you should be using json= versus data= since your headers indicate you're passing JSON.
Craig
Reply all
Reply to author
Forward
0 new messages