I had the same problem. This worked for me, just wrting this because I 
couldn't find an answer in stackoverflow or other sites. 

+1

Thanks

On Thursday, September 2, 2010 8:19:37 AM UTC-3, irum wrote:
>
> Thank you so much, it worked:)...Now I just have to play with parsing 
> json that I think I can manage. 
>
> Thanks again:) 
>
> Irum 
>
> On Sep 2, 1:11 pm, Daniel Roseman <[email protected]> wrote: 
> > On Sep 2, 10:37 am, irum <[email protected]> wrote: 
> > 
> > 
> > 
> > > Hi, 
> > > Thanks for your prompt reply. 
> > > I have tried both the things but I get the same error. 
> > > With, 
> > > x = json.loads(p.read()) 
> > >            print x 
> > 
> > > I get following error:  'HttpResponse' object has no attribute 
> > > 'read' 
> > > Also I get same error with, json.dumps(p.read()), and same when I use 
> > > loads and dumps as load and dump without s. 
> > 
> > > Then, I tried the other option, 
> > 
> > > x = json.dump(p) 
> > >         print x 
> > 
> > > I get the following error: dump() takes at least 2 arguments (1 given) 
> > > What would be the second argument, I googled on this but find no 
> > > helpful tips as everything written is too complicated. 
> > 
> > > And with: 
> > >            x = json.load(p) 
> > >            print x 
> > 
> > > 'HttpResponse' object has no attribute 'read' 
> > 
> > > In all the examples, p is the HttpResponse object I get. 
> > 
> > > Looking forward, 
> > > Irum 
> > 
> > Apologies for steering you wrong - that'll teach me to post without 
> > checking. 
> > 
> > You're right that HttpResponse doesn't have a read() method, contrary 
> > to what I thought. So neither of those methods will work. Instead, get 
> > the content of the response and call loads() on that: 
> > 
> >     json.loads(p.content) 
> > 
> > -- 
> > DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to