Creates a new Cookie with the given attributes.
Use [[email protected]_secure] and [[email protected]_http_only] if you need to set those attributes on the returned cookie.
If domain
starts with ".", that indicates a domain (which matches the string after the ".", or any hostname that has
domain
as a suffix). Otherwise, it is a hostname and must match exactly.
max_age
is used to set the "expires" attribute on the cookie; pass -1 to not include the attribute (indicating that the
cookie expires with the current session), 0 for an already-expired cookie, or a lifetime in seconds. You can use the constants
soup_cookie_max_age_one_hour, soup_cookie_max_age_one_day,
soup_cookie_max_age_one_week and soup_cookie_max_age_one_year (or
multiples thereof) to calculate this value. (If you really care about setting the exact time that the cookie will expire, use [
[email protected]_expires].)
name |
cookie name |
value |
cookie value |
domain |
cookie domain or hostname |
path |
cookie path, or null |
max_age |
max age of the cookie, or -1 for a session cookie |
a new Cookie. |