Hello everyone,
I am with a problem that I am not understand the why... Basically I can't set cookies on Tornado/Python, either normal cookie or secure cookie. Below is my code:
class API(BaseHandler):
def get(self):
self.set_secure_cookie("a_cookie", "a_value")
a_cookie = self.get_secure_cookie("a_cookie")
print(">>> a_cookie ", a_cookie)
self.set_cookie("a_cookie", "a_value")
a_cookie = self.get_cookie("a_cookie")
print(">>> a_cookie ", a_cookie)
The output is:
>>> a_cookie None
>>> a_cookie None
The class BaseHandler extends the tornado.web.RequestHandler.
About the secure cookie, I set the cookie_secret.
I am not understanding the reason of when I set a cookie, I can't get it. I believe that I'm following the rules on sites (
http://www.tornadoweb.org/en/stable/guide/security.html ,
https://technobeans.com/2012/08/07/tornado-cookies/)
(PS: I put this issue on StackOverFlow too [
https://stackoverflow.com/questions/47116421/i-cant-set-cookies-on-tornado-python ])
Thanks in advance.
Rodrigo