Skip to content

Instantly share code, notes, and snippets.

@amalgjose
Last active October 30, 2022 20:43
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalgjose/2d7a91589494da3fc37b to your computer and use it in GitHub Desktop.
Save amalgjose/2d7a91589494da3fc37b to your computer and use it in GitHub Desktop.
Sample service using python tornado with SSL.
__author__ = 'Amal G Jose'
import os
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
class HelloWorldHandler(tornado.web.RequestHandler):
def get(self):
print "Someone called me"
self.write("Welcome to Tornado with SSL..!!")
if __name__ == "__main__":
app = tornado.web.Application(handlers=[(r"/", HelloWorldHandler)])
http_server = tornado.httpserver.HTTPServer(app, ssl_options={
"certfile": os.path.join("ca.crt"),
"keyfile": os.path.join("ca.key"),
})
http_server.listen(443)
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment