retrieve raw post data

23 views
Skip to first unread message

Kirby Turner

unread,
Jan 3, 2009, 11:54:14 PM1/3/09
to web...@googlegroups.com
I'm working on an app that will be called by an external system. The
external system will send a post request to my server passing XML as
raw data. My app needs to retrieve the raw post data. Searching the
group I discovered that I can retrieve the raw post data using:

request.body.read()

Before searching the group I searched through the source code, but I
didn't find anything about request.body. I'm curious how does this
work. Can someone point me in the right direction, or to a source
file, so I can learn more. Also, is this the best, only option from
retrieving the raw post data?

On a related note, I have not made a posting to AlterEgo yet. Others
might find the request.body.read() tip useful so I would like to make
a posting. Are there rules about posting to AlterEgo? Can anyone
post a new entry? I'm always hesitant posting to public areas list
AlterEgo when I'm new to a community like this one.

Thanks,
-KIRBY

mdipierro

unread,
Jan 4, 2009, 8:04:42 AM1/4/09
to web2py Web Framework
Hi Kirby,

> request.body.read()
>
> Before searching the group I searched through the source code, but I
> didn't find anything about request.body. I'm curious how does this
> work.

in gluon/main.py

request.body=tempfile.TemporaryFile()
if request.env.content_length:
copystream(request.env.wsgi_input,request.body,
int(request.env.content_length))

This,request.env.wsgi_input, is standard wsgi so should be documented
somewhere.

> On a related note, I have not made a posting to AlterEgo yet. Others
> might find the request.body.read() tip useful so I would like to make
> a posting. Are there rules about posting to AlterEgo?

Not really. It is published until I approve it. So far I have approved
everything form members of the group.

> Can anyone post a new entry?

yes

> I'm always hesitant posting to public areas list AlterEgo when I'm new to a community like this one.

do not be.

you may also want to consider (in addition, not in alternative) to
post on

http://mdp.cti.depaul.edu/web2py_wiki

Massimo

Kirby Turner

unread,
Jan 6, 2009, 2:09:30 PM1/6/09
to web...@googlegroups.com

On Jan 4, 2009, at 8:04 AM, mdipierro wrote:

> you may also want to consider (in addition, not in alternative) to
> post on
>
> http://mdp.cti.depaul.edu/web2py_wiki

I'm getting "invalid function" when I go to the URL above.

-KIRBY

Yarko Tymciurak

unread,
Jan 6, 2009, 2:13:38 PM1/6/09
to web...@googlegroups.com

Timothy Farrell

unread,
Jan 6, 2009, 2:15:13 PM1/6/09
to web...@googlegroups.com
www.web2pywiki.com will point you to where you need to go.
-- 
Timothy Farrell <tfar...@swgen.com>
Computer Guy
Statewide General Insurance Agency (www.swgen.com)

Kirby Turner

unread,
Jan 6, 2009, 2:26:53 PM1/6/09
to web...@googlegroups.com
Thanks Yarko and Timothy.

-KIRBY

mdipierro

unread,
Jan 6, 2009, 2:29:15 PM1/6/09
to web2py Web Framework
good job Tim,

Massimo

On Jan 6, 1:15 pm, Timothy Farrell <tfarr...@swgen.com> wrote:
> www.web2pywiki.comwill point you to where you need to go.
> Kirby Turner wrote:On Jan 4, 2009, at 8:04 AM, mdipierro wrote:you may also want to consider (in addition, not in alternative) to post onhttp://mdp.cti.depaul.edu/web2py_wikiI'm getting "invalid function" when I go to the URL above. -KIRBY-- Timothy Farrell<tfar...@swgen.com>Computer Guy Statewide General Insurance Agency (www.swgen.com)
Reply all
Reply to author
Forward
0 new messages