On 4 Mar 2014, at 9:19 AM, Avi A <aviavi...@gmail.com> wrote:
> I do the same I get:
> TypeError: string indices must be integers, not str
> 
> 

Try catching that exception and printing the object you're working with.

It sounds like you're indexing the json string (r.content) rather than the 
result of json.loads.

> 
> On Tuesday, March 4, 2014 3:35:31 PM UTC+2, Avi A wrote:
> Hi,
> I'm getting on a controller a json response as expected, and I didn't find a 
> way how to parse it yet:
> 
> r = requests.post(url, data=json.dumps(payload), headers=headers)
> r.content returns something like that:
> {
>   "owner_ids": [
> 
>   ],
>   "labels": [
>     {
>       "id": 7864106,
>       "created_at": "2014-03-04T10:39:27Z",
>       "project_id": 941736,
>       "name": "label",
>       "kind": "label",
>       "updated_at": "2014-03-04T10:39:27Z"
>     }
>   ],
>   "current_state": "unscheduled",
>   "id": 66856110,
>   "created_at": "2014-03-04T13:31:33Z",
>   "story_type": "bug",
>   "project_id": 941736,
>   "name": "title",
>   "url": "http://www.pivotaltracker.com/story/show/66856110";,
>   "kind": "story",
>   "updated_at": "2014-03-04T13:31:33Z",
>   "requested_by_id": 735355,
>   "description": "story http://google.com/105";
> }
> 
> Thanks.
> 
> 
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> --- 
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to