Logo
latest
  • User’s Guide
    • Install
    • Deploy
      • Local Serving
      • Deploying a Server
    • Glossary
    • Tutorials
      • Tutorial: Hello World
        • Simple Request Handler
        • Building Routes
        • Building the Webapp
        • Setting the Application Variable
      • Tutorial: Request Interceptors
        • The Request Interceptor Code
        • Routing Requests Through The Request Interceptor
      • Tutorial: Response Interceptors
        • The Response Interceptor Code
        • Routing Responses Through The Response Interceptor
      • Tutorial: Error Handlers
        • Building a Python Named Exception
        • Raising an Exception
        • Writing a Error Handling Method
        • Associating an Error Type with An Error Handler
        • Adding Error Handlers To The Web App
      • Tutorial: Decorators
        • The Handler
        • The Interceptor
        • The Decorator
        • Wiring Up Dependencies
        • Setting Up The Routes
      • Tutorial: Adding Values To Requests
        • New Imports
        • Building An Explicit Request Wrapper Class
        • Updating the Request
        • Adding the Interceptor
    • Contributing
      • Bugs and Features
      • Open for Contributions
      • Generating Documentation
    • Frequently Asked Questions
  • API Documentation
    • Request
    • Response
    • Error Handlers Builder
    • Exceptions
    • Eynnyd Webapp Builder
    • Response Builder
    • Response Cookie Builder
    • RoutesBuilder
EYNNYD
  • Docs »
  • API Documentation »
  • Response Cookie Builder
  • Edit on GitHub

Response Cookie Builder¶

class eynnyd.response_cookie_builder.ResponseCookieBuilder(name, value)[source]¶

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.

__init__(name, value)[source]¶

Constructs an initial ResponseCookieBuilder with common defaults.

Parameters
  • name – a valid cookie name (via rfc spec)

  • value – a valid cookie value (via rfc spec)

set_expires(expires)[source]¶

Sets the cookie to include an expiry date.

Parameters

expires – a date, parsable by python Arrow

Returns

This builder to allow for fluent design.

set_expires_in_days(days_till_expiry)[source]¶

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.

set_max_age(max_age)[source]¶

Sets the max age of the cookie.

Parameters

max_age – an rfc compliant max age

Returns

This builder to allow for fluent design.

set_domain(domain)[source]¶

Sets the limiting domain for the cookie.

Parameters

domain – an rfc compliant domain

Returns

This builder to allow for fluent design.

set_path(path)[source]¶

Sets the limiting path for the cookie.

Parameters

path – an rfc compliant path

Returns

This builder to allow for fluent design.

set_secure(secure)[source]¶

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.

set_http_only(http_only)[source]¶

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.

build()[source]¶

Validates the name and value and builds the ResponseCookie object. :return: a valid ResponseCookie object.

Next Previous

© Copyright 2019, Chad Befus Revision 1b25281a.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
Versions
master
latest
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.