Reputation: 11038
I'm trying to get a basic grasp on what the communication is like between an ajax request and tornado, but I can't find any functions which give me something I can pass to print()
I've checked the API http://www.tornadoweb.org/en/stable/web.html and every function with the word "get" in it seems to require that I first know the name of the thing I'm trying to get.
I'm not quite there yet with my understanding, and would like to start by just printing everything there is to print. All the headers, all the data, going in and out.
How do I do this?
#pseudo code
class MainHandler(tornado.web.RequestHandler):
def get(self):
everything = self.getIncomingHeaders + self.getDataSentByAjaxCall
print(everything)
Upvotes: 1
Views: 977
Reputation: 24027
Do this:
def get(self):
print("%r %s" % (self.request, self.request.body.decode()))
For a "get" there is no request body, but you can put the same code in a "put" or "post" method and see the full request body along with headers, path, and so on.
Upvotes: 2