Cookie (class)

February 4, 2018 ยท View on GitHub

API categories | API index

Cookie (class)

See also CookieManager.SetCookie(), CookieVisitor.Visit() and ResourceHandler.CanGetCookie / CanSetCookie.

Table of contents:

Methods

Set

ParameterType
cookiedict
Returnvoid

Set cookie properties via a dict.

The cookie may have the following keys:

  • name (str)
  • value (str)
  • domain (str)
  • path (str)
  • secure (bool)
  • httpOnly (bool)
  • creation (datetime.datetime)
  • lastAccess (datetime.datetime)
  • hasExpires (bool)
  • expires (datetime.datetime)

Get

Returndict

Get all cookie properties as a dict.

SetName

ParameterType
namestring
Returnvoid

Set the cookie name.

GetName

Returnstring

Get the cookie name.

SetValue

ParameterType
valuestring
Returnvoid

Set the cookie value.

GetValue

Returnstring

Get the cookie value.

SetDomain

ParameterType
domainstring
Returnvoid

If |domain| is empty a host cookie will be
created instead of a domain cookie. Domain cookies are stored with a
leading "." and are visible to sub-domains whereas host cookies are
not.

GetDomain

Returnstring

Get the cookie domain.

SetPath

ParameterType
pathstring
Returnvoid

If |path| is non-empty only URLs at or below the path will get the
cookie value.

GetPath

Returnstring

Get the cookie path.

SetSecure

ParameterType
securebool
Returnvoid

If |secure| is true the cookie will only be sent for HTTPS requests.

GetSecure

Returnbool

Get the secure property.

SetHttpOnly

ParameterType
httpOnlybool
Returnvoid

If |httponly| is true the cookie will only be sent for HTTP requests.

GetHttpOnly

Returnbool

Get the httpOnly property.

SetCreation

ParameterType
creationdatetime.datetime
Returnvoid

The cookie creation date. This is automatically populated by the system on
cookie creation.

GetCreation

Returndatetime.datetime

Get the creation property.

SetLastAccess

ParameterType
lastAccessdatetime.datetime
Returnvoid

The cookie last access date. This is automatically populated by the system
on access.

GetLastAccess

Returndatetime.datetime

Get the lastAccess property.

SetHasExpires

ParameterType
hasExpiresbool
Returnvoid

The cookie expiration date is only valid if |hasExpires| is true.

GetHasExpires

Returnbool

Get the hasExpires property.

SetExpires

ParameterType
expiresdatetime.datetime
Returnvoid

Set the cookie expiration date. You should also call SetHasExpires().

GetExpires

Returndatetime.datetime

Get the expires property.