Created
October 31, 2018 03:30
-
-
Save kinow/49438dd3187e7c01e3ac0c3f088fc234 to your computer and use it in GitHub Desktop.
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
import tornado.web | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
if not self.get_cookie("mycookie"): | |
self.set_cookie("mycookie", "myvalue") | |
self.write("Your cookie was not set yet!") | |
else: | |
self.write("Your cookie was set!") | |
settings = { | |
"cookie_secret": "testing", | |
"httponly": True | |
# "login_url": "/login", | |
} | |
application = tornado.web.Application([ | |
(r"/", MainHandler), | |
], **settings) | |
application.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