python flask not creating cookie when setting expiration -
I have this python-flask project and I need logic, if cookie does not exist, then cookie creates.
After creating cookies, I need to store cookies in a database for tracking purposes among other standards.
Here is partial of my current code:
code above the task and expected Appears as cookie, although this cookie is omitted from the end of the browser session.
I need to set a cookie where after the expiration of X it will end after the browser, but when I change this line:
rsp. Set_cookie (key, GUID)
to
rsp.set_cookie (key, GUID, expires = 90)
This is not created
>
You max_age = 90
needs to be set up, or use datetime
for your end:
Example:
Import datetime Expire_date = datetim E.datetime.now () expire_date = expire_date + datetime.timedelta (day = 90) response.set_cookie (key, GUID, expires = expire_date)
Comments
Post a Comment