Hi Hans, self.request is an instance of webob's Request object. If you're just stringifying it (with str(), repr(), or implicitly), it will attempt to show its contents in a way that seems sensible, but that's not necessarily how it was sent over the wire. self.request.body will contain the raw body of the request, exactly as it's sent over the wire. If that's URLEncoded instead of formencoded, that's because your request was sent URLEncoded.
-Nick Johnson On Thu, Jan 27, 2011 at 7:09 PM, Hans <[email protected]>wrote: > Hi Nick, > > thanks for the reply. I already tried self.request.body, but it is > just a subset of self.request. > It also seems that the value is already processed somehow by the > serverengine because it only returns (according to my example): > comment=foobar&image_file=FieldStorage%28%27image_file%27%2C+ > %27Blume.jpg%27%29 > > What I want is the body as send by the client, e.g.: > [...] > ------------ThIs_Is_tHe_bouNdaRY_$ > Content-Disposition: form-data; name="comment" > > foobar > [...] > > On 27 Jan., 06:57, "Nick Johnson (Google)" <[email protected]> > wrote: > > Hi Hans, > > > > You can access the request body via self.request.body. > > > > -Nick Johnson > > > > On Thu, Jan 27, 2011 at 1:28 AM, Hans <[email protected] > >wrote: > > > Hello! > > > > > I'd like to have access to the raw post data an app receives. > > > > > The output of self.request in a webapp.RequestHandler is not complete > > > or it is already modified by the server-engine (dev_appserver or the > > > real GAE). > > > > > If I send multipart/form-data to the app the body of the original > > > request is something like this: > > > [...] > > > ------------ThIs_Is_tHe_bouNdaRY_$ > > > Content-Disposition: form-data; name="comment" > > > > > foobar > > > > > ------------ThIs_Is_tHe_bouNdaRY_$ > > > Content-Disposition: form-data; name="image_file"; > > > filename="flower.jpg" > > > Content-Type: image/jpeg > > > > > ...binary data... > > > [...] > > > > > The example body conent is processed correctly in the app engine, but > > > self.request returns this: > > > POST /upload > > > Content-Length: -1 > > > Content-Type: multipart/form-data; boundary=---------- > > > ThIs_Is_tHe_bouNdaRY_$ > > > Host: dev.example.local:8080 > > > > > comment=foobar&image_file=FieldStorage%28%27image_file%27%2C+ > > > %27Blume.jpg%27%29 > > > > > The body is different here. How can I access the correct body or > > > complete raw post data? > > > > > Sincerly, > > > Hans > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "Google App Engine" group. > > > To post to this group, send email to [email protected] > . > > > To unsubscribe from this group, send email to > > > [email protected]<google-appengine%[email protected]> > <google-appengine%[email protected]<google-appengine%[email protected]> > > > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-appengine?hl=en. > > > > -- > > Nick Johnson, Developer Programs Engineer, App Engine > > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration > Number: > > 368047 > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
