Response Cookie Builder¶
Response cookies are generally just key-value pairs but can be more complicated. Using this builder allows for simple creation of generic or complex cookies with validation.
Constructs an initial ResponseCookieBuilder with common defaults.
- Parameters
name – a valid cookie name (via rfc spec)
value – a valid cookie value (via rfc spec)
Sets the cookie to include an expiry date.
- Parameters
expires – a date, parsable by python Arrow
- Returns
This builder to allow for fluent design.
Sets the cookie to include an expiry date in days from now.
- Parameters
days_till_expiry – number of days from now to the expiry time.
- Returns
This builder to allow for fluent design.
Sets the max age of the cookie.
- Parameters
max_age – an rfc compliant max age
- Returns
This builder to allow for fluent design.
Sets the limiting domain for the cookie.
- Parameters
domain – an rfc compliant domain
- Returns
This builder to allow for fluent design.
Sets the limiting path for the cookie.
- Parameters
path – an rfc compliant path
- Returns
This builder to allow for fluent design.
Sets whether the cookie is secure or not.
- Parameters
secure – a boolean to indicate if we are setting secure or insecure
- Returns
This builder to allow for fluent design.
Sets whether the cookie is http only or not.
- Parameters
http_only – a boolean to indicate if we are setting http only or not
- Returns
This builder to allow for fluent design.
Validates the name and value and builds the ResponseCookie object. :return: a valid ResponseCookie object.