Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import tornado.ioloop
- import tornado.web
- import time
- from threading import Timer
- class MainHandler(tornado.web.RequestHandler):
- @tornado.web.asynchronous
- def get(self):
- t = Timer(5.0, self.on_response)
- t.start()
- print 'thread started'
- def on_response(self):
- self.write(str(time.time()))
- self.finish()
- application = tornado.web.Application([
- (r"/", MainHandler),
- ])
- if __name__ == "__main__":
- application.listen(8888)
- tornado.ioloop.IOLoop.instance().start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement