Skip to content

Instantly share code, notes, and snippets.

@yuxel
Created June 19, 2010 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuxel/445068 to your computer and use it in GitHub Desktop.
Save yuxel/445068 to your computer and use it in GitHub Desktop.
import tornado.httpserver
import tornado.ioloop
import tornado.web
import time
class FeedgetService(tornado.web.RequestHandler):
#i'm willing that method will run async
@tornado.web.asynchronous
def get(self, url):
print("trying for " + url)
time.sleep(10)
self.write("fetched data for " + url)
self.finish()
application = tornado.web.Application([
(r"/test/(.*)", FeedgetService),
])
if __name__ == "__main__":
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(8888)
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment