Assembly allows you to easily, set, get and delete cookie. It exposes some functions to help you with that.
from assembly import set_cookie, get_cookie, delete_cookie
To set a cookie
from assembly import (Assembly, set_cookie) class Index(Assembly): def index(self): set_cookie("my_key", "my_value") return
To retrieve a cookie. It will return
None if the key doesn't exist.
You can also retrieve the cookie with
from assembly import (Assembly, get_cookie) class Index(Assembly): def index(self): get_cookie("my_key") return
To delete a cookie that was set. It will silently fail if it doesn't exist
from assembly import (Assembly, delete_cookie) class Index(Assembly): def index(self): delete_cookie("my_key") return
delete_cookie(self, key, path="/", domain=None) Delete a cookie. Fails silently if key doesn't exist. :param key: the key (name) of the cookie to be deleted. :param path: if the cookie that should be deleted was limited to a path, the path has to be defined here. :param domain: if the cookie that should be deleted was limited to a domain, that domain has to be defined here.