python 龙卷风getattr
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 龙卷风getattr相关的知识,希望对你有一定的参考价值。
#!/usr/bin/env python
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define, options
define("port", default=8888, help="run on the given port", type=int)
class BaseHandler(tornado.web.RequestHandler):
def get(self):
self.write("This is the response from the BaseHandler\n")
class MainHandler(BaseHandler):
def get(self):
getattr(BaseHandler, 'get')(self)
class TestHandler(BaseHandler):
pass
def main():
tornado.options.parse_command_line()
application = tornado.web.Application([
(r"/", MainHandler),
(r"/test", TestHandler),
], debug=True)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(options.port)
tornado.ioloop.IOLoop.current().start()
if __name__ == "__main__":
main()
以上是关于python 龙卷风getattr的主要内容,如果未能解决你的问题,请参考以下文章
python龙卷风中的SSL(https)
python 龙卷风
python 龙卷风的websocket样本
python 龙卷风异步爬虫演示
python 龙卷风pubsub
python 龙卷风AsyncHTTPSTestCase示例