set_cookie(key, value='', max_age=None, expires=None, path='/', domain=None, secure=None, httponly=False)¶
Sets a cookie. The parameters are the same as in the cookie Morsel object in the Python standard library but it accepts unicode data, too.
- key – the key (name) of the cookie to be set.
- value – the value of the cookie.
- max_age – should be a number of seconds, or None (default) if the cookie should last only as long as the client’s browser session.
- expires – should be a datetime object or UNIX timestamp.
- domain – if you want to set a cross-domain cookie. For example,
domain=".example.com"will set a cookie that is readable by the domain
foo.example.cometc. Otherwise, a cookie will only be readable by the domain that set it.
- path – limits the cookie to a given path, per default it will span the whole domain.