Re: [Twisted-Python] http.Request and JSON

2012-01-25 Thread Glyph Lefkowitz
On Jan 25, 2012, at 5:28 AM, Gerrat wrote: > Tristan Seligmann mithrandi.net> writes: > >> >> On Tue, Jun 30, 2009 at 10:44 AM, Reza Lotun gmail.com> wrote: >>> To be safer, I do a request.content.getvalue() since content is a >>> cStringIO object and you can never be sure if somewhere along t

Re: [Twisted-Python] http.Request and JSON

2012-01-25 Thread Gerrat
Tristan Seligmann mithrandi.net> writes: > > On Tue, Jun 30, 2009 at 10:44 AM, Reza Lotun gmail.com> wrote: > > To be safer, I do a request.content.getvalue() since content is a > > cStringIO object and you can never be sure if somewhere along the > > chain of processing someone hasn't done a .r

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Itamar Shtull-Trauring
On Tue, 2009-06-30 at 21:56 +0800, Vincent Gulinao wrote: > In my case at least it's cStringIO, and getvalue() sufficed. > > Sorry, subscribing to twisted-web now. > > Thanks everyone. One last followup, for those not on twisted-web: DO NOT use getvalue(). The promised interface is file-like. An

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Vincent Gulinao
In my case at least it's cStringIO, and getvalue() sufficed. Sorry, subscribing to twisted-web now. Thanks everyone. On Tue, Jun 30, 2009 at 8:41 PM, Jean-Paul Calderone wrote: > On Tue, 30 Jun 2009 13:12:05 +0100, Reza Lotun wrote: >>Hi, >> >>On Tue, Jun 30, 2009 at 12:56 PM, Tristan >>Seligma

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Jean-Paul Calderone
On Tue, 30 Jun 2009 13:12:05 +0100, Reza Lotun wrote: >Hi, > >On Tue, Jun 30, 2009 at 12:56 PM, Tristan >Seligmann wrote: >>> To be safer, I do a request.content.getvalue() since content is a >>> cStringIO object and you can never be sure if somewhere along the >>> chain of processing someone hasn

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Reza Lotun
Hi, On Tue, Jun 30, 2009 at 12:56 PM, Tristan Seligmann wrote: >> To be safer, I do a request.content.getvalue() since content is a >> cStringIO object and you can never be sure if somewhere along the >> chain of processing someone hasn't done a .read and forgot to do a >> .seek(0,0). > > You shou

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Tristan Seligmann
On Tue, Jun 30, 2009 at 10:44 AM, Reza Lotun wrote: > To be safer, I do a request.content.getvalue() since content is a > cStringIO object and you can never be sure if somewhere along the > chain of processing someone hasn't done a .read and forgot to do a > .seek(0,0). You should probably do the

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Reza Lotun
Hi, On Tue, Jun 30, 2009 at 9:18 AM, Phil Mayers wrote: > request.content.read() To be safer, I do a request.content.getvalue() since content is a cStringIO object and you can never be sure if somewhere along the chain of processing someone hasn't done a .read and forgot to do a .seek(0,0). Chee

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Vincent Gulinao
works :) On Tue, Jun 30, 2009 at 4:18 PM, Phil Mayers wrote: > On Tue, Jun 30, 2009 at 09:07:57AM +0100, Vincent Gulinao wrote: >>How do you read JSON content from a POST using http.Request. I peeked >>on args and it's empty. > > "args" is www-urlencoded only. If the content-type is something else

Re: [Twisted-Python] http.Request and JSON

2009-06-30 Thread Phil Mayers
On Tue, Jun 30, 2009 at 09:07:57AM +0100, Vincent Gulinao wrote: >How do you read JSON content from a POST using http.Request. I peeked >on args and it's empty. "args" is www-urlencoded only. If the content-type is something else it's not filled in. You want: request.content.read() IIRC _

[Twisted-Python] http.Request and JSON

2009-06-30 Thread Vincent Gulinao
How do you read JSON content from a POST using http.Request. I peeked on args and it's empty. TIA. ___ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python