Created
June 19, 2010 16:17
-
-
Save yuxel/445024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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