Last active
October 30, 2022 20:43
-
-
Save amalgjose/2d7a91589494da3fc37b to your computer and use it in GitHub Desktop.
Sample service using python tornado with SSL.
This file contains hidden or 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
__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