Set Custom Cookies on a Response
Write cookies with set_cookie and options.
Cookies Beyond Sessions
Sometimes you want your own cookie, separate from the session, to remember a theme or a preference for a visitor. 🍪
You Need a Response
Cookies are written onto a response object. So first build one with make_response instead of returning a plain string.
from flask import make_response
resp = make_response('Hi there')All lessons in this course
- Set and Read the session Dict
- The SECRET_KEY and Signed Cookies
- Set Custom Cookies on a Response
- Flash Messages Between Requests