WebKit2.CookieManager¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted when cookies are added, removed or modified. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class WebKit2.CookieManager(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Defines how to handle cookies in a
WebKit2.WebContext
.The
WebKit2.CookieManager
defines how to set up and handle cookies. You can get it from aWebKit2.WebsiteDataManager
withWebKit2.WebsiteDataManager.get_cookie_manager
(), and use it to set where to store cookies withWebKit2.CookieManager.set_persistent_storage
(), or to set the acceptance policy, withWebKit2.CookieManager.get_accept_policy
().- add_cookie(cookie, cancellable, callback, *user_data)¶
- Parameters:
cookie (
Soup.Cookie
) – theSoup.Cookie
to be addedcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously add a
Soup.Cookie
to the underlying storage.When the operation is finished, callback will be called. You can then call
WebKit2.CookieManager.add_cookie_finish
() to get the result of the operation.New in version 2.20.
- add_cookie_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
Finish an asynchronous operation started with
WebKit2.CookieManager.add_cookie
().New in version 2.20.
- delete_all_cookies()¶
Delete all cookies of self.
Deprecated since version 2.16: Use
WebKit2.WebsiteDataManager.clear
() instead.
- delete_cookie(cookie, cancellable, callback, *user_data)¶
- Parameters:
cookie (
Soup.Cookie
) – theSoup.Cookie
to be deletedcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously delete a
Soup.Cookie
from the current session.When the operation is finished, callback will be called. You can then call
WebKit2.CookieManager.delete_cookie_finish
() to get the result of the operation.New in version 2.20.
- delete_cookie_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
Finish an asynchronous operation started with
WebKit2.CookieManager.delete_cookie
().New in version 2.20.
- delete_cookies_for_domain(domain)¶
- Parameters:
domain (
str
) – a domain name
Remove all cookies of self for the given domain.
Deprecated since version 2.16: Use
WebKit2.WebsiteDataManager.remove
() instead.
- get_accept_policy(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously get the cookie acceptance policy of self.
Note that when policy was set to
WebKit2.CookieAcceptPolicy.NO_THIRD_PARTY
and ITP is enabled, this will returnWebKit2.CookieAcceptPolicy.ALWAYS
. See alsoWebKit2.WebsiteDataManager.set_itp_enabled
().When the operation is finished, callback will be called. You can then call
WebKit2.CookieManager.get_accept_policy_finish
() to get the result of the operation.
- get_accept_policy_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
the cookie acceptance policy of self as a
WebKit2.CookieAcceptPolicy
.- Return type:
Finish an asynchronous operation started with
WebKit2.CookieManager.get_accept_policy
().
- get_all_cookies(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – (closure user_data): aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously get a list of
Soup.Cookie
from self.When the operation is finished, callback will be called. You can then call
WebKit2.CookieManager.get_all_cookies_finish
() to get the result of the operation.New in version 2.42.
- get_all_cookies_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
A
GLib.List
ofSoup.Cookie
instances.- Return type:
Finish an asynchronous operation started with
WebKit2.CookieManager.get_all_cookies
().The return value is a
GLib.List
ofSoup.Cookie
instances which should be released with g_list_free_full() andSoup.Cookie.free
().New in version 2.42.
- get_cookies(uri, cancellable, callback, *user_data)¶
- Parameters:
uri (
str
) – the URI associated to the cookies to be retrievedcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously get a list of
Soup.Cookie
from self.Asynchronously get a list of
Soup.Cookie
from self associated with uri, which must be either an HTTP or an HTTPS URL.When the operation is finished, callback will be called. You can then call
WebKit2.CookieManager.get_cookies_finish
() to get the result of the operation.New in version 2.20.
- get_cookies_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
A
GLib.List
ofSoup.Cookie
instances.- Return type:
Finish an asynchronous operation started with
WebKit2.CookieManager.get_cookies
().The return value is a
GLib.List
ofSoup.Cookie
instances which should be released with g_list_free_full() andSoup.Cookie.free
().New in version 2.20.
- get_domains_with_cookies(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously get the list of domains for which self contains cookies.
When the operation is finished, callback will be called. You can then call
WebKit2.CookieManager.get_domains_with_cookies_finish
() to get the result of the operation.Deprecated since version 2.16: Use
WebKit2.WebsiteDataManager.fetch
() instead.
- get_domains_with_cookies_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
A
None
terminated array of domain names orNone
in case of error.- Return type:
[
str
]
Finish an asynchronous operation started with
WebKit2.CookieManager.get_domains_with_cookies
().The return value is a
None
terminated list of strings which should be released withGLib.strfreev
().Deprecated since version 2.16: Use
WebKit2.WebsiteDataManager.fetch_finish
() instead.
- replace_cookies(cookies, cancellable, callback, *user_data)¶
- Parameters:
cookies ([
Soup.Cookie
]) – aGLib.List
ofSoup.Cookie
to be addedcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – (closure user_data): aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously replace all cookies in self with the given list of cookies.
When the operation is finished, callback will be called. You can then call
WebKit2.CookieManager.replace_cookies_finish
() to get the result of the operation.New in version 2.42.
- replace_cookies_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
Finish an asynchronous operation started with
WebKit2.CookieManager.replace_cookies
().New in version 2.42.
- set_accept_policy(policy)¶
- Parameters:
policy (
WebKit2.CookieAcceptPolicy
) – aWebKit2.CookieAcceptPolicy
Set the cookie acceptance policy of self as policy.
Note that ITP has its own way to handle third-party cookies, so when it’s enabled, and policy is set to
WebKit2.CookieAcceptPolicy.NO_THIRD_PARTY
,WebKit2.CookieAcceptPolicy.ALWAYS
will be used instead. Once disabled, the policy will be set back toWebKit2.CookieAcceptPolicy.NO_THIRD_PARTY
. See alsoWebKit2.WebsiteDataManager.set_itp_enabled
().
- set_persistent_storage(filename, storage)¶
- Parameters:
filename (
str
) – the filename to read to/write fromstorage (
WebKit2.CookiePersistentStorage
) – aWebKit2.CookiePersistentStorage
Set non-session cookies.
Set the filename where non-session cookies are stored persistently using storage as the format to read/write the cookies. Cookies are initially read from filename to create an initial set of cookies. Then, non-session cookies will be written to filename when the
WebKit2.CookieManager
::changed
signal is emitted. By default, self doesn’t store the cookies persistently, so you need to call this method to keep cookies saved across sessions.This method should never be called on a
WebKit2.CookieManager
associated to an ephemeralWebKit2.WebsiteDataManager
.
Signal Details¶
- WebKit2.CookieManager.signals.changed(cookie_manager)¶
- Signal Name:
changed
- Flags:
- Parameters:
cookie_manager (
WebKit2.CookieManager
) – The object which received the signal
This signal is emitted when cookies are added, removed or modified.