Skip to content

Instantly share code, notes, and snippets.

@kinow
Created October 31, 2018 03:30
Show Gist options
  • Save kinow/49438dd3187e7c01e3ac0c3f088fc234 to your computer and use it in GitHub Desktop.
Save kinow/49438dd3187e7c01e3ac0c3f088fc234 to your computer and use it in GitHub Desktop.
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