# eric6.Helpviewer.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
AcceptNever
AcceptOnlyFromSitesNavigatedTo
Allow
AllowForSession
Block
JAR_VERSION
KeepUntilExit
KeepUntilExpire
KeepUntilTimeLimit

### Class Methods

None

### Methods

CookieJar | Constructor
__applyRules | Private method to apply the cookie rules.
__isOnDomainList | Private method to check, if either the rule matches the domain exactly or the domain ends with ".rule".
__purgeOldCookies | Private method to purge old cookies.
acceptPolicy | Public method to get the accept policy.
allowForSessionCookies | Public method to return the allowed session cookies.
allowedCookies | Public method to return the allowed cookies.
blockedCookies | Public method to return the blocked cookies.
clear | Public method to clear all cookies.
close | Public slot to close the cookie jar.
cookies | Public method to get the cookies of the cookie jar.
cookiesForUrl | Public method to get the cookies for a URL.
filterTrackingCookies | Public method to get the filter tracking cookies flag.
keepPolicy | Public method to get the keep policy.
load | Public method to load the cookies.
loadCookies | Public method to restore the saved cookies.
save | Public method to save the cookies.
saveCookies | Public method to save the cookies.
setAcceptPolicy | Public method to set the accept policy.
setAllowForSessionCookies | Public method to set the list of allowed session cookies.
setAllowedCookies | Public method to set the list of allowed cookies.
setBlockedCookies | Public method to set the list of blocked cookies.
setCookies | Public method to set all cookies.
setCookiesFromUrl | Public method to set cookies for a URL.
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.__applyRules

__applyRules()

Private method to apply the cookie rules.

#### 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.__purgeOldCookies

__purgeOldCookies()

Private method to purge old cookies.

#### CookieJar.acceptPolicy

acceptPolicy()

Public method to get the accept policy.

Returns:
  current accept policy

#### CookieJar.allowForSessionCookies

allowForSessionCookies()

Public method to return the allowed session cookies.

Returns:
  list of allowed session cookies (list of strings)

#### CookieJar.allowedCookies

allowedCookies()

Public method to return the allowed cookies.

Returns:
  list of allowed cookies (list of strings)

#### CookieJar.blockedCookies

blockedCookies()

Public method to return the blocked cookies.

Returns:
  list of blocked cookies (list of strings)

#### CookieJar.clear

clear()

Public method to clear all cookies.

#### CookieJar.close

close()

Public slot to close the cookie jar.

#### CookieJar.cookies

cookies()

Public method to get the cookies of the cookie jar.

Returns:
  list of all cookies (list of QNetworkCookie)

#### CookieJar.cookiesForUrl

cookiesForUrl(url)

Public method to get the cookies for a URL.

url
  URL to get cookies for (QUrl)

Returns:
  list of 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.load

load()

Public method to load the cookies.

#### CookieJar.loadCookies

loadCookies(cookies)

Public method to restore the saved cookies.

cookies
  byte array containing the saved cookies (QByteArray)

Returns:
  list of cookies

#### CookieJar.save

save()

Public method to save the cookies.

#### CookieJar.saveCookies

saveCookies(cookiesList)

Public method to save the cookies.

cookiesList
  list of cookies to be saved

Returns:
  saved cookies as a byte array (QByteArray)

#### 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 cookies.

list_
  list of allowed session cookies (list of strings)

#### CookieJar.setAllowedCookies

setAllowedCookies(list_)

Public method to set the list of allowed cookies.

list_
  list of allowed cookies (list of strings)

#### CookieJar.setBlockedCookies

setBlockedCookies(list_)

Public method to set the list of blocked cookies.

list_
  list of blocked cookies (list of strings)

#### CookieJar.setCookies

setCookies(cookies)

Public method to set all cookies.

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

#### CookieJar.setCookiesFromUrl

setCookiesFromUrl(cookieList, url)

Public method to set cookies for a URL.

cookieList
  list of cookies to set (list of QNetworkCookie)
url
  url to set cookies for (QUrl)

Returns:
  flag indicating cookies were set (boolean)

#### 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