Cookie (class)
February 4, 2018 ยท View on GitHub
Cookie (class)
See also CookieManager.SetCookie(), CookieVisitor.Visit() and ResourceHandler.CanGetCookie / CanSetCookie.
Table of contents:
Methods
Set
| Parameter | Type |
|---|---|
| cookie | dict |
| Return | void |
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
| Return | dict |
Get all cookie properties as a dict.
SetName
| Parameter | Type |
|---|---|
| name | string |
| Return | void |
Set the cookie name.
GetName
| Return | string |
Get the cookie name.
SetValue
| Parameter | Type |
|---|---|
| value | string |
| Return | void |
Set the cookie value.
GetValue
| Return | string |
Get the cookie value.
SetDomain
| Parameter | Type |
|---|---|
| domain | string |
| Return | void |
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
| Return | string |
Get the cookie domain.
SetPath
| Parameter | Type |
|---|---|
| path | string |
| Return | void |
If |path| is non-empty only URLs at or below the path will get the
cookie value.
GetPath
| Return | string |
Get the cookie path.
SetSecure
| Parameter | Type |
|---|---|
| secure | bool |
| Return | void |
If |secure| is true the cookie will only be sent for HTTPS requests.
GetSecure
| Return | bool |
Get the secure property.
SetHttpOnly
| Parameter | Type |
|---|---|
| httpOnly | bool |
| Return | void |
If |httponly| is true the cookie will only be sent for HTTP requests.
GetHttpOnly
| Return | bool |
Get the httpOnly property.
SetCreation
| Parameter | Type |
|---|---|
| creation | datetime.datetime |
| Return | void |
The cookie creation date. This is automatically populated by the system on
cookie creation.
GetCreation
| Return | datetime.datetime |
Get the creation property.
SetLastAccess
| Parameter | Type |
|---|---|
| lastAccess | datetime.datetime |
| Return | void |
The cookie last access date. This is automatically populated by the system
on access.
GetLastAccess
| Return | datetime.datetime |
Get the lastAccess property.
SetHasExpires
| Parameter | Type |
|---|---|
| hasExpires | bool |
| Return | void |
The cookie expiration date is only valid if |hasExpires| is true.
GetHasExpires
| Return | bool |
Get the hasExpires property.
SetExpires
| Parameter | Type |
|---|---|
| expires | datetime.datetime |
| Return | void |
Set the cookie expiration date. You should also call SetHasExpires().
GetExpires
| Return | datetime.datetime |
Get the expires property.