# eric6.WebBrowser.CookieJar.CookieJar

Module implementing a QNetworkCookieJar subclass with various accept policies.

### Global Attributes

None

### Classes

CookieJar | Class implementing a QNetworkCookieJar subclass with various accept policies.

### Functions

None

## CookieJar

Class implementing a QNetworkCookieJar subclass with various accept policies.

### Signals

cookiesChanged()
  emitted after the cookies have been changed

### Derived from

QNetworkCookieJar

### Class Attributes

AcceptAlways
AcceptMax
AcceptNever
AcceptOnlyFromSitesNavigatedTo
Allow
AllowForSession
Block
KeepMax
KeepUntilExit
KeepUntilExpire

### Class Methods

None

### Methods

CookieJar | Constructor
__cookieAdded | Private slot handling the addition of a cookie.
__cookieFilter | Private method to filter cookies.
__cookieRemoved | Private slot handling the removal of a cookie.
__isOnDomainList | Private method to check, if either the rule matches the domain exactly or the domain ends with ".rule".
__load | Private method to load the cookies settings.
__matchDomain | Private method to check, if a URLs host matches a cookie domain according to RFC 6265.
__rejectCookie | Private method to test, if a cookie shall be rejected.
__save | Private method to save the cookies settings.
acceptPolicy | Public method to get the accept policy.
allowForSessionCookies | Public method to return the list of allowed session cookie domains.
allowedCookies | Public method to return the list of allowed domains.
blockedCookies | Public method to return the list of blocked domains.
clear | Public method to clear all cookies.
close | Public slot to close the cookie jar.
cookieDomains | Public method to get a list of all domains used by the cookies.
cookies | Public method to get the cookies of the cookie jar.
filterTrackingCookies | Public method to get the filter tracking cookies flag.
keepPolicy | Public method to get the keep policy.
removeCookie | Public method to remove a cookie.
removeCookies | Public method to remove a list of cookies.
setAcceptPolicy | Public method to set the accept policy.
setAllowForSessionCookies | Public method to set the list of allowed session cookie domains.
setAllowedCookies | Public method to set the list of allowed domains.
setBlockedCookies | Public method to set the list of blocked domains.
setFilterTrackingCookies | Public method to set the filter tracking cookies flag.
setKeepPolicy | Public method to set the keep policy.

### Static Methods

None

#### CookieJar (Constructor)

CookieJar(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### CookieJar.__cookieAdded

__cookieAdded(cookie)

Private slot handling the addition of a cookie.

cookie (QNetworkCookie)
  cookie which was added

#### CookieJar.__cookieFilter

__cookieFilter(request)

Private method to filter cookies.

Note: This method is used for Qt 5.11+ only.

request (QWebEngineCookieStore.FilterRequest)
  reference to the cookie filter request object

Returns:
  flag indicating cookie access is allowed

Return Type:
  bool

#### CookieJar.__cookieRemoved

__cookieRemoved(cookie)

Private slot handling the removal of a cookie.

cookie (QNetworkCookie)
  cookie which was removed

#### CookieJar.__isOnDomainList

__isOnDomainList(rules, domain)

Private method to check, if either the rule matches the domain exactly or the domain ends with ".rule".

rules
  list of rules (list of strings)
domain
  domain name to check (string)

Returns:
  flag indicating a match (boolean)

#### CookieJar.__load

__load()

Private method to load the cookies settings.

#### CookieJar.__matchDomain

__matchDomain(cookieDomain, siteDomain)

Private method to check, if a URLs host matches a cookie domain according to RFC 6265.

cookieDomain (str)
  domain of the cookie
siteDomain (str)
  domain or host of an URL

Returns:
  flag indicating a match

Return Type:
  bool

#### CookieJar.__rejectCookie

__rejectCookie(cookie, cookieDomain)

Private method to test, if a cookie shall be rejected.

cookie (QNetworkCookie)
  cookie to be tested
cookieDomain (str)
  domain of the cookie

Returns:
  flag indicating the cookie shall be rejected

Return Type:
  bool

#### CookieJar.__save

__save()

Private method to save the cookies settings.

#### CookieJar.acceptPolicy

acceptPolicy()

Public method to get the accept policy.

Returns:
  current accept policy

#### CookieJar.allowForSessionCookies

allowForSessionCookies()

Public method to return the list of allowed session cookie domains.

Returns:
  list of allowed session cookie domains (list of strings)

#### CookieJar.allowedCookies

allowedCookies()

Public method to return the list of allowed domains.

Returns:
  list of allowed domains (list of strings)

#### CookieJar.blockedCookies

blockedCookies()

Public method to return the list of blocked domains.

Returns:
  list of blocked domains (list of strings)

#### CookieJar.clear

clear()

Public method to clear all cookies.

#### CookieJar.close

close()

Public slot to close the cookie jar.

#### CookieJar.cookieDomains

cookieDomains()

Public method to get a list of all domains used by the cookies.

Returns:
  list of domain names

Return Type:
  list of str

#### CookieJar.cookies

cookies()

Public method to get the cookies of the cookie jar.

Returns:
  list of all cookies (list of QNetworkCookie)

#### CookieJar.filterTrackingCookies

filterTrackingCookies()

Public method to get the filter tracking cookies flag.

Returns:
  filter tracking cookies flag (boolean)

#### CookieJar.keepPolicy

keepPolicy()

Public method to get the keep policy.

Returns:
  keep policy

#### CookieJar.removeCookie

removeCookie(cookie)

Public method to remove a cookie.

cookie (QNetworkCookie)
  cookie to be removed

#### CookieJar.removeCookies

removeCookies(cookies)

Public method to remove a list of cookies.

cookies (list of QNetworkCookie)
  list of cookies to be removed

#### CookieJar.setAcceptPolicy

setAcceptPolicy(policy)

Public method to set the accept policy.

policy
  accept policy to be set

#### CookieJar.setAllowForSessionCookies

setAllowForSessionCookies(list_)

Public method to set the list of allowed session cookie domains.

list_
  list of allowed session cookie domains (list of strings)

#### CookieJar.setAllowedCookies

setAllowedCookies(list_)

Public method to set the list of allowed domains.

list_
  list of allowed domains (list of strings)

#### CookieJar.setBlockedCookies

setBlockedCookies(list_)

Public method to set the list of blocked domains.

list_
  list of blocked domains (list of strings)

#### CookieJar.setFilterTrackingCookies

setFilterTrackingCookies(filterTrackingCookies)

Public method to set the filter tracking cookies flag.

filterTrackingCookies
  filter tracking cookies flag (boolean)

#### CookieJar.setKeepPolicy

setKeepPolicy(policy)

Public method to set the keep policy.

policy
  keep policy to be set

Up