Re: [Raw] post data

"Jonathan Ellis" <[email protected]>
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
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 farce.  --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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.