[Zope3-Users] Accessing raw post data

Adam GROSZER agroszer at gmail.com
Fri Aug 27 04:02:45 EDT 2010


Hello Edoardo,

Just make sure you test your app with retries.

Friday, August 27, 2010, 9:50:31 AM, you wrote:

ES> Hi guys,

ES> I just found that I can get the body of the POST request through:

ES> request.bodyStream.getCacheStream()

ES> Thanks for your contribution

ES> Edoardo

ES> On Aug 24, 2010, at 10:30 PM, Edoardo Serra wrote:

>> Hi Adam,
>>       thanks for your help, z3c.jsonrpc did what I was looking for.
>> 
>> I now need to access the raw post data because I also have to deal with non JSON content.
>> I'm handling a file upload through javascript and the file content is passed in the request body.
>> 
>> Do you know how to handle that?
>> 
>> Thanks
>> 
>> Edoardo
>> 
>> 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 
>>> 
>> 
>> Edoardo Serra
>> 
>> SATISFLY Limited
>> 66/F The Center
>> 99 Queen's Road Central
>> Hong Kong
>> 
>> http://www.satisfly.com/airline
>> 
>> _______________________________________________
>> Zope3-users mailing list
>> Zope3-users at zope.org
>> https://mail.zope.org/mailman/listinfo/zope3-users

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:
Diligence is the mother of good fortune, and idleness, its opposite, never brought a man to the goal of any of his best wishes. 
- Cervantes 



More information about the Zope3-users mailing list