No the body stays there until the end of the transaction (i.e. http response sent).
d = json.load(request.body) if something already consumed the body? no problem it is a permanent buffer, then you can rewind: request.body.seek(0) d = json.load(request.body) 2013/4/3 Daniel Gonzalez <[email protected]>: > I see. So I assume I will have to parse the json myself. > I wonder if after @request.restful() has done its job, I can still access > the body. > I need to parse the json data, but maybe the body is already consumed ... > > On Wednesday, April 3, 2013 9:24:47 AM UTC+2, Niphlod wrote: >> >> the restful part parses the data as web2py does, so accepts form/* encoded >> parameters... it doesn't parse json in the body. >> >> On Wednesday, April 3, 2013 8:19:04 AM UTC+2, Daniel Gonzalez wrote: >>> >>> Sorry to come back to this after two weeks (was busy with other stuff). I >>> am trying to access the post_vars, but they are emtpy (Storage {}) >>> My PUT request body is coming from an emberjs client, and looks like this >>> (this is just test data): >>> >>> >>> {"node":{"type":"voicemenu","name":"sdfsfd","outputs":{"jumpIfBusy":null,"startnode":null,"jumpIfNoAnswer":null,"exten":null},"properties":{"record":null,"multilocator":null,"locator":null}}} >>> >>> But this data is not in post_vars. I do not understand very well what you >>> mean by: >>> >>> "basically request.post_vars are the variables in body whether it is PUT >>> or POST or other." >>> >>> I do not have "variables in the body", I have json data. This should be >>> parsed as json. Should I do it manually, or is @request.restful() doing that >>> automatically? (I can not see it in the code). >>> >>> Thanks, >>> Daniel >>> >>> On Friday, March 22, 2013 6:02:32 AM UTC+1, Massimo Di Pierro wrote: >>>> >>>> if request.env.request_method=='POST': >>>> put_vars = request.post_vars >>>> >>>> basically request.post_vars are the variables in body whether it is PUT >>>> or POST or other. >>>> >>>> >>>> >>>> On Thursday, 21 March 2013 19:10:27 UTC-5, Daniel Gonzalez wrote: >>>>> >>>>> Hi, >>>>> >>>>> How can I access the data in the PUT request? (in the body of the >>>>> request) >>>>> Can this be automatically parsed (my data is JSON) >>>>> >>>>> Thanks, >>>>> Daniel > > -- > > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

