WebKit.CookieManager

g GObject.Object GObject.Object WebKit.CookieManager WebKit.CookieManager GObject.Object->WebKit.CookieManager

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

add_cookie (cookie, cancellable, callback, *user_data)

add_cookie_finish (result)

delete_cookie (cookie, cancellable, callback, *user_data)

delete_cookie_finish (result)

get_accept_policy (cancellable, callback, *user_data)

get_accept_policy_finish (result)

get_all_cookies (cancellable, callback, *user_data)

get_all_cookies_finish (result)

get_cookies (uri, cancellable, callback, *user_data)

get_cookies_finish (result)

replace_cookies (cookies, cancellable, callback, *user_data)

replace_cookies_finish (result)

set_accept_policy (policy)

set_persistent_storage (filename, storage)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Name

Short Description

changed

This signal is emitted when cookies are added, removed or modified.

Fields

Inherited:

GObject.Object (1)

Class Details

class WebKit.CookieManager(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit.CookieManagerClass

Defines how to handle cookies in a WebKit.WebContext.

The WebKit.CookieManager defines how to set up and handle cookies. You can get it from a WebKit.WebsiteDataManager with webkit_website_data_manager_get_cookie_manager(), and use it to set where to store cookies with WebKit.CookieManager.set_persistent_storage(), or to set the acceptance policy, with WebKit.CookieManager.get_accept_policy().

Parameters:

Asynchronously add a Soup.Cookie to the underlying storage.

When the operation is finished, callback will be called. You can then call WebKit.CookieManager.add_cookie_finish() to get the result of the operation.

New in version 2.20.

Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the cookie was added or False in case of error.

Return type:

bool

Finish an asynchronous operation started with WebKit.CookieManager.add_cookie().

New in version 2.20.

Parameters:

Asynchronously delete a Soup.Cookie from the current session.

When the operation is finished, callback will be called. You can then call WebKit.CookieManager.delete_cookie_finish() to get the result of the operation.

New in version 2.20.

Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the cookie was deleted or False in case of error.

Return type:

bool

Finish an asynchronous operation started with WebKit.CookieManager.delete_cookie().

New in version 2.20.

get_accept_policy(cancellable, callback, *user_data)
Parameters:

Asynchronously get the cookie acceptance policy of self.

Note that when policy was set to WebKit.CookieAcceptPolicy.NO_THIRD_PARTY and ITP is enabled, this will return WebKit.CookieAcceptPolicy.ALWAYS. See also webkit_website_data_manager_set_itp_enabled().

When the operation is finished, callback will be called. You can then call WebKit.CookieManager.get_accept_policy_finish() to get the result of the operation.

get_accept_policy_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

the cookie acceptance policy of self as a WebKit.CookieAcceptPolicy.

Return type:

WebKit.CookieAcceptPolicy

Finish an asynchronous operation started with WebKit.CookieManager.get_accept_policy().

get_all_cookies(cancellable, callback, *user_data)
Parameters:

Asynchronously get a list of Soup.Cookie from self.

When the operation is finished, callback will be called. You can then call WebKit.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) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

A GLib.List of Soup.Cookie instances.

Return type:

[Soup.Cookie]

Finish an asynchronous operation started with WebKit.CookieManager.get_all_cookies().

The return value is a GLib.List of Soup.Cookie instances which should be released with g_list_free_full() and Soup.Cookie.free().

New in version 2.42.

get_cookies(uri, cancellable, callback, *user_data)
Parameters:

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 WebKit.CookieManager.get_cookies_finish() to get the result of the operation.

New in version 2.20.

get_cookies_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

A GLib.List of Soup.Cookie instances.

Return type:

[Soup.Cookie]

Finish an asynchronous operation started with WebKit.CookieManager.get_cookies().

The return value is a GLib.List of Soup.Cookie instances which should be released with g_list_free_full() and Soup.Cookie.free().

New in version 2.20.

replace_cookies(cookies, cancellable, callback, *user_data)
Parameters:

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 WebKit.CookieManager.replace_cookies_finish() to get the result of the operation.

New in version 2.42.

replace_cookies_finish(result)
Parameters:

result (Gio.AsyncResult) – a Gio.AsyncResult

Raises:

GLib.Error

Returns:

True if the cookies were added or False in case of error.

Return type:

bool

Finish an asynchronous operation started with WebKit.CookieManager.replace_cookies().

New in version 2.42.

set_accept_policy(policy)
Parameters:

policy (WebKit.CookieAcceptPolicy) – a WebKit.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 WebKit.CookieAcceptPolicy.NO_THIRD_PARTY, WebKit.CookieAcceptPolicy.ALWAYS will be used instead. Once disabled, the policy will be set back to WebKit.CookieAcceptPolicy.NO_THIRD_PARTY. See also webkit_website_data_manager_set_itp_enabled().

set_persistent_storage(filename, storage)
Parameters:

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 WebKit.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 WebKit.CookieManager associated to an ephemeral WebKit.WebsiteDataManager.

Signal Details

WebKit.CookieManager.signals.changed(cookie_manager)
Signal Name:

changed

Flags:

RUN_LAST

Parameters:

cookie_manager (WebKit.CookieManager) – The object which received the signal

This signal is emitted when cookies are added, removed or modified.