Re: [Raw] post data
"Lars Eriksen" <[email protected]>
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <003801c5fb0e$d2dfe690$3701a8c0@targa> |
Thanks Jonathan, but it does not work the way I use it (mod_python):
[[\
req = request._api.getRequest()
print req.read()
]]
It prints nothing. If I use the Spyce standalone server, the script
freezes - seems req.read() blocks. How do I read the raw data from the
request in a mod_python environment?
----- Original Message -----
From: "Jonathan Ellis" <[email protected]>
To: "Lars Eriksen" <[email protected]>; "Spyce Users"
<[email protected]>
Sent: Tuesday, December 06, 2005 6:56 PM
Subject: Re: [Spyce-users] [Raw] post data
> On Tue, 6 Dec 2005 18:07:08 +0100, "Lars Eriksen" <[email protected]>
> said:
>> It seems to be more difficult than accessing a simple variable like in
>> PHP.
>> There should be a method "body(...)" complementing "getHeader(...)" as
>> part
>> of the request module.
>>
>> I wrote an extremely simple and lightweight RPC-protocol on top of HTTP
>> and
>> don't want to use multi part form data encoding to send data to a .spy
>> script - and url encoded data seems extremely inefficient considering my
>> data is zlib-compressed.
>>
>> I've created the PHP equivalent before and it turned out to work
>> flawlessly - no need for any fancy encoding.
>>
>> I've read another post in the list's archive, someone else had trouble
>> retrieving the raw post (body) data - and IIRC he did not have the luxury
>> of
>> using a "proper" encoding. Unfortunately no one replied.
>>
>> So how do you do it?
>
> Well, the Right Thing to do is clearly to have your library do a proper
> POST that spyce could process normally. (And this isn't hard to do with
> the python urllib/urllib2 modules, either.)
>
> But if you really want to kludge it like this, import the request module
> and read from the file-like object returned by
> request._api.getRequest().
>
> -Jonathan
> --
> C++ is history repeated as tragedy. Java is history repeated as
> arce. --Scott McKay
>
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click