Skip to content

Instantly share code, notes, and snippets.

@selcukusta
Created April 29, 2018 22:08
Show Gist options
  • Select an option

  • Save selcukusta/165cc2adbbf7e133907a6061c5d27f0a to your computer and use it in GitHub Desktop.

Select an option

Save selcukusta/165cc2adbbf7e133907a6061c5d27f0a to your computer and use it in GitHub Desktop.
import tornado.ioloop
import tornado.web
import socket
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello world!")
def data_received(self, data):
pass
class StatusHandler(tornado.web.RequestHandler):
def get(self):
self.write(socket.gethostname())
def data_received(self, data):
pass
def application_start():
return tornado.web.Application([
(r"/", MainHandler),
(r"/status", StatusHandler)
])
if __name__ == "__main__":
APP = application_start()
APP.listen(8888)
tornado.ioloop.IOLoop.current().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment