[Zope3-Users] Accessing raw post data

Adam GROSZER agroszer at gmail.com
Wed Aug 25 07:06:49 EDT 2010


Hello Edoardo,

I think the simplest would be to make the upload a
multipart/form-data, with some headers added if you can.
Worst case putting the necessary text manually around the binary?
Then it's a usual POST request what's easily parsed by zope.
Otherwise it could be really nasty.

Tuesday, August 24, 2010, 10:30:59 PM, you wrote:

ES> Hi Adam,
ES>         thanks for your help, z3c.jsonrpc did what I was looking for.

ES> I now need to access the raw post data because I also have to deal with non JSON content.
ES> I'm handling a file upload through javascript and the file
ES> content is passed in the request body.

ES> Do you know how to handle that?

ES> Thanks

ES> Edoardo

ES> On Jul 22, 2010, at 11:02 AM, Adam GROSZER wrote:

>> Hello Edoardo,
>> 
>> You might be interested in z3c.json, z3c.jsonrpc.
>> Especially z3c.jsonrpc, that should handle such requests with ease.
>> 
>> Wednesday, July 21, 2010, 7:33:29 PM, you wrote:
>> 
>> ES> Hi guys,
>> ES>         I need to access the body of an HTTP POST request.
>> 
>> ES> The request has content type of 'application/json' and the body is a JSON-encoded string.
>> 
>> ES> I tried to access the bodyStream attribute of the BrowserRequest object but it always
>> returns an
>> ES> empty string.
>> 
>> ES> I used a network analyzer to see the content of the HTTP Request which follows:
>> 
>> ES> POST /facebook-realtime-callback.html HTTP/1.1
>> ES> Host: www.satisfly.com
>> ES> Accept: */*
>> ES> Content-Type: application/json
>> ES> X-Hub-Signature: sha1=d2a5fd64c731bfdc50578db1a297b195853b5bac
>> ES> Content-Length: 173
>> 
>> ES>
>> {"object":"user","entry":[{"uid":"100001314277196","changed_fields":["picture"],"time":1279728528},{"uid":"100001314277196","changed_fields":["picture"],"time":1279728528}]}
>> 
>> ES> I'm using Zope 3.3.1 on debian etch
>> 
>> ES> Your help would be really appreciated
>> 
>> ES> Regards,
>> 
>> ES> Edoardo Serra
>> 
>> ES> SATISFLY Limited
>> ES> 66/F The Center
>> ES> 99 Queen's Road Central
>> ES> Hong Kong
>> 
>> ES> http://www.satisfly.com/airline
>> 
>> ES> _______________________________________________
>> ES> Zope3-users mailing list
>> ES> Zope3-users at zope.org
>> ES> https://mail.zope.org/mailman/listinfo/zope3-users
>> 
>> 
>> -- 
>> Best regards,
>> Adam GROSZER                            mailto:agroszer at gmail.com
>> --
>> Quote of the day:
>> Nothing ever built arose to touch the skies unless some man dreamed that it should, some man
>> believed that it could, and some man willed that it must. 
>> - Charles F. Kettering 
>> 

ES> Edoardo Serra

ES> SATISFLY Limited
ES> 66/F The Center
ES> 99 Queen's Road Central
ES> Hong Kong

ES> http://www.satisfly.com/airline

ES> _______________________________________________
ES> Zope3-users mailing list
ES> Zope3-users at zope.org
ES> https://mail.zope.org/mailman/listinfo/zope3-users


-- 
Best regards,
 Adam GROSZER                            mailto:agroszer at gmail.com
--
Quote of the day:
There is no remedy for sex but more sex.



More information about the Zope3-users mailing list