WebsiteDataManager

Added in version 2.10.

class WebsiteDataManager(**properties: Any)

Superclasses: Object

Manages data stored locally by web sites.

You can use WebKitWebsiteDataManager to configure the local directories where website data will be stored. Use WebsiteDataManager:base-data-directory and WebsiteDataManager:base-cache-directory set a common base directory for all website data and caches.

A WebKitWebsiteDataManager can be ephemeral, in which case all the directory configuration is not needed because website data will never persist. You can create an ephemeral WebKitWebsiteDataManager with webkit_website_data_manager_new_ephemeral().

WebKitWebsiteDataManager can also be used to fetch website data, remove data stored by particular websites, or clear data for all websites modified since a given period of time.

Methods

class WebsiteDataManager
clear(types: WebsiteDataTypes, timespan: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronously clear the website data of the given types modified in the past timespan.

If timespan is 0, all website data will be removed.

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

Due to implementation limitations, this function does not currently delete any stored cookies if timespan is nonzero. This behavior may change in the future.

Added in version 2.16.

Parameters:
  • typesWebsiteDataTypes

  • timespan – a TimeSpan

  • cancellable – a Cancellable or None to ignore

  • callback – a AsyncReadyCallback to call when the request is satisfied

  • user_data – the data to pass to callback function

clear_finish(result: AsyncResult) bool

Finish an asynchronous operation started with clear()

Added in version 2.16.

Parameters:

result – a AsyncResult

fetch(types: WebsiteDataTypes, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronously get the list of WebsiteData for the given types.

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

Added in version 2.16.

Parameters:
  • typesWebsiteDataTypes

  • cancellable – a Cancellable or None to ignore

  • callback – a AsyncReadyCallback to call when the request is satisfied

  • user_data – the data to pass to callback function

fetch_finish(result: AsyncResult) list[WebsiteData]

Finish an asynchronous operation started with fetch().

Added in version 2.16.

Parameters:

result – a AsyncResult

get_base_cache_directory() str | None

Get the WebsiteDataManager:base-cache-directory property.

Added in version 2.10.

get_base_data_directory() str | None

Get the WebsiteDataManager:base-data-directory property.

Added in version 2.10.

get_favicon_database() FaviconDatabase | None

Get the FaviconDatabase of manager.

Added in version 2.40.

get_favicons_enabled() bool

Get whether website icons are enabled.

Added in version 2.40.

get_itp_summary(cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronously get the list of ITPThirdParty seen for manager.

Every ITPThirdParty contains the list of ITPFirstParty under which it has been seen.

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

Added in version 2.30.

Parameters:
  • cancellable – a Cancellable or None to ignore

  • callback – a AsyncReadyCallback to call when the request is satisfied

  • user_data – the data to pass to callback function

get_itp_summary_finish(result: AsyncResult) list[ITPThirdParty]

Finish an asynchronous operation started with get_itp_summary().

Added in version 2.30.

Parameters:

result – a AsyncResult

is_ephemeral() bool

Get whether a WebsiteDataManager is ephemeral.

See WebsiteDataManager:is-ephemeral for more details.

Added in version 2.16.

remove(types: WebsiteDataTypes, website_data: list[WebsiteData], cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None

Asynchronously removes the website data in the given website_data list.

Asynchronously removes the website data of the given types for websites in the given website_data list. Use clear() if you want to remove the website data for all sites.

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

Added in version 2.16.

Parameters:
  • typesWebsiteDataTypes

  • website_data – a List of WebsiteData

  • cancellable – a Cancellable or None to ignore

  • callback – a AsyncReadyCallback to call when the request is satisfied

  • user_data – the data to pass to callback function

remove_finish(result: AsyncResult) bool

Finish an asynchronous operation started with remove().

Added in version 2.16.

Parameters:

result – a AsyncResult

set_favicons_enabled(enabled: bool) None

Set whether website icons are enabled. Website icons are disabled by default. When website icons are disabled, the FaviconDatabase of manager is closed and its reference removed, so get_favicon_database() will return None. If website icons are enabled again, a new FaviconDatabase will be created.

Added in version 2.40.

Parameters:

enabled – value to set

Properties

class WebsiteDataManager
props.base_cache_directory: str

The base directory for caches. If None, a default location will be used.

Added in version 2.10.

props.base_data_directory: str

The base directory for website data. If None, a default location will be used.

Added in version 2.10.

props.is_ephemeral: bool

Whether the WebsiteDataManager is ephemeral. An ephemeral WebsiteDataManager handles all websites data as non-persistent, and nothing will be written to the client storage. Note that if you create an ephemeral WebsiteDataManager all other construction parameters to configure data directories will be ignored.

Added in version 2.16.

props.origin_storage_ratio: float

The percentage of volume space that can be used for data storage for every domain. If the maximum storage is reached the storage request will fail with a QuotaExceededError exception. A value of 0.0 means that data storage is not allowed. A value of -1.0, which is the default, means WebKit will use the default quota (1 GiB).

Added in version 2.42.

props.total_storage_ratio: float

The percentage of volume space that can be used for data storage for all domains. If the maximum storage is reached the eviction will happen. A value of 0.0 means that data storage is not allowed. A value of -1.0, which is the default, means there’s no limit for the total storage.

Added in version 2.42.