python tornado get request url -
here code:
class mainhandler(tornado.web.requesthandler): def get(self): self.write(self.request.url) def main(): settings = {"template_path": "html","static_path": "static"} tornado.options.parse_command_line() application = tornado.web.application([ (r"/story/page1", mainhandler), ],**settings) i want string "/story/page1". how ?
you can current url inside requesthandler using self.request.uri:
class mainhandler(tornado.web.requesthandler): def get(self): self.write(self.request.uri)
Comments
Post a Comment