Cookie¶

class Cookie.Cookie(name, value)¶

Bases: object

Delicious cookies.

Cookie is used to create cookies that have additional attributes beyond their value.

Note that web browsers don’t typically send any information with the cookie other than its value. Therefore HTTPRequest.cookie simply returns a value such as an integer or a string.

When the server sends cookies back to the browser, it can send a cookie that simply has a value, or the cookie can be accompanied by various attributes (domain, path, max-age, …) as described in RFC 2109. Therefore, in HTTPResponse, setCookie can take either an instance of the Cookie class, as defined in this module, or a value.

Note that Cookie values get pickled (see the pickle module), so you can set and get cookies that are integers, lists, dictionaries, etc.

__init__(name, value)¶

Create a cookie.

Properties other than name and value are set with methods.

comment()¶
delete()¶

Delete a cookie.

When sent, this should delete the cookie from the user’s browser, by making it empty, expiring it in the past, and setting its max-age to 0. One of these will delete the cookie for any browser (which one actually works depends on the browser).

domain()¶
expires()¶
headerValue()¶

Return header value.

Returns a string with the value that should be used in the HTTP headers.

httpOnly()¶
isSecure()¶
maxAge()¶
name()¶
path()¶
sameSite()¶
setComment(comment)¶
setDomain(domain)¶
setExpires(expires)¶
setHttpOnly(httpOnly=True)¶
setMaxAge(maxAge)¶
setPath(path)¶
setSameSite(sameSite='Strict')¶
setSecure(secure=True)¶
setValue(value)¶
setVersion(version)¶
value()¶
version()¶

Webware for Python 3

Navigation

Contents:

  • Overview
  • Installation
  • List of Changes
  • Migration Guide
  • Copyright and License
  • Quickstart
  • Beginner Tutorial
  • Application Development
  • Configuration
  • Deployment
  • Plug-ins
  • Style Guidelines
  • PSP
  • UserKit
  • TaskKit
  • WebUtils
  • MiscUtils
  • Testing
  • API Reference
    • Core Classes
    • PSP
    • UserKit
    • TaskKit
    • WebUtils
    • MiscUtils

Related Topics

  • Documentation overview
    • API Reference
      • Core Classes
        • Previous: ConfigurableForServerSidePath
        • Next: ExceptionHandler

Quick search

©1999-2023, Christoph Zwerschke et al. | Powered by Sphinx 6.2.1 & Alabaster 0.7.13 | Page source