Skip to content

Instantly share code, notes, and snippets.

@yuxel
Created June 19, 2010 16:17
Show Gist options
  • Save yuxel/445024 to your computer and use it in GitHub Desktop.
Save yuxel/445024 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):
def doSomethingWhichTakes10Seconds(self, url):
time.sleep(10)
return "i wait 10 seconds of for " + url
#i even treid aysnc requests but it doesnt work
@tornado.web.asynchronous
def get(self, url):
print("trying for " + url)
response = self.doSomethingWhichTakes10Seconds(url);
self.write(response)
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