0

I noticed something, as I am trying to setup a sample Restful API test project using this site - https://jsonplaceholder.typicode.com/. According to the docs on the site, when trying to make a post call I just need to pass the id, all I need to do is to call the endpoint thus: https://jsonplaceholder.typicode.com/todos/4, this should return this:

{
  "userId": 1,
  "id": 4,
  "title": "et porro tempora",
  "completed": true
}

Whenever I pass only the ID in my post call using Python LocustIO, I'm getting 500 server error, it only do return 201, which is success when I add the whole json object like this:

 {
      "userId": 1,
      "id": 4,
      "title": "et porro tempora",
      "completed": true
 }

And secondly when I on this line it will always return :

if sorted(a.items()) == sorted(b.items()):
AttributeError: 'list' object has no attribute 'items'

What's the way forward, as this thread did not solve the problem - Python WordCloud meet AttributeError: 'list' object has no attribute 'items'?

halfer
  • 19,824
  • 17
  • 99
  • 186
ken4ward
  • 2,246
  • 5
  • 49
  • 89
  • 1
    to fix `AttributeError: 'list' object has no attribute 'items'` Error just do this if sorted(a) == sorted(b): because your object a and b are lists, dictionary objects have attribute named items not lists . – toheedNiaz Apr 10 '18 at 12:02
  • Thanks @toheedNiaz, this solved the problem instantly. appreciate a bunch. What about the json passed? – ken4ward Apr 10 '18 at 12:07
  • Didn't read the doc, but I believe you'd have to make a GET request – Adonis Apr 10 '18 at 12:08

0 Answers0