Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Robot Framework: Rest call gives "unicode object has no attribute copy" error

Below error occurring on my code

${resp}=  Post Request  sw3  https://sw3-   test.test1.com/api/v1/test1/patients
\  ...  Content-Type:application/json
\  ...  Authorization:authkey02    Accept=application/json

Error as follows

KEYWORD ${resp} = RequestsLibrary . Post Request sw3, https://sw3-test.test1.com/api/v1/test1/patients, Content-Type:application/json, Authorization:authkey02, Accept=application/json
Documentation:  
Send a POST request on the session object found using the
Start / End / Elapsed:  20170315 12:08:21.283 / 20170315 12:08:21.285 / 00:00:00.002
12:08:21.283    TRACE   Arguments: [ 'sw3' | 'https://sw3-test.test1.com/api/v1/test1/patients' | 'Content-Type:application/json' | 'Authorization:authkey02' | 'Accept=application/json' ] 
12:08:21.284    FAIL    AttributeError: 'unicode' object has no attribute 'copy'

This works ok if i do not use the third line of code - what gives?

like image 850
Ray Avatar asked Dec 09 '25 08:12

Ray


1 Answers

You can give it a try like passing those key:value pairs as a dictionary Header variable.

&{Header}=   Content-Type:application/json    Authorization:authkey02 
   Accept=application/json


${resp} = RequestsLibrary.Post Request  sw3   https://sw3-test.test1.com/api/v1/test1/patients    headers=${Header}
like image 68
Nadeem Avatar answered Dec 15 '25 15:12

Nadeem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!