WebsiteDataManager#
Added in version 2.10.
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
- async clear(self, types: WebsiteDataTypes, timespan: int) bool#
This is the awaitable version of
clear().Added in version 2.16.
- Parameters:
types –
WebsiteDataTypestimespan – a
TimeSpan
- clear(types: WebsiteDataTypes, timespan: int, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
Asynchronously clear the website data of the given
typesmodified in the pasttimespan.If
timespanis 0, all website data will be removed.When the operation is finished,
callbackwill be called. You can then callclear_finish()to get the result of the operation.Due to implementation limitations, this function does not currently delete any stored cookies if
timespanis nonzero. This behavior may change in the future.Added in version 2.16.
- Parameters:
types –
WebsiteDataTypestimespan – a
TimeSpancancellable – a
CancellableorNoneto ignorecallback – a
AsyncReadyCallbackto call when the request is satisfieduser_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
- async fetch(self, types: WebsiteDataTypes) list[WebsiteData]#
This is the awaitable version of
fetch().Added in version 2.16.
- Parameters:
types –
WebsiteDataTypes
- fetch(types: WebsiteDataTypes, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
Asynchronously get the list of
WebsiteDatafor the giventypes.When the operation is finished,
callbackwill be called. You can then callfetch_finish()to get the result of the operation.Added in version 2.16.
- Parameters:
types –
WebsiteDataTypescancellable – a
CancellableorNoneto ignorecallback – a
AsyncReadyCallbackto call when the request is satisfieduser_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
FaviconDatabaseofmanager.Added in version 2.40.
- async get_itp_summary(self) list[ITPThirdParty]#
This is the awaitable version of
get_itp_summary().Added in version 2.30.
- get_itp_summary(cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
Asynchronously get the list of
ITPThirdPartyseen formanager.Every
ITPThirdPartycontains the list ofITPFirstPartyunder which it has been seen.When the operation is finished,
callbackwill be called. You can then callget_itp_summary_finish()to get the result of the operation.Added in version 2.30.
- Parameters:
cancellable – a
CancellableorNoneto ignorecallback – a
AsyncReadyCallbackto call when the request is satisfieduser_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
WebsiteDataManageris ephemeral.See
WebsiteDataManager:is-ephemeral for more details.Added in version 2.16.
- async remove(self, types: WebsiteDataTypes, website_data: list[WebsiteData]) bool#
This is the awaitable version of
remove().Added in version 2.16.
- Parameters:
types –
WebsiteDataTypeswebsite_data – a
ListofWebsiteData
- remove(types: WebsiteDataTypes, website_data: list[WebsiteData], cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
Asynchronously removes the website data in the given
website_datalist.Asynchronously removes the website data of the given
typesfor websites in the givenwebsite_datalist. Useclear()if you want to remove the website data for all sites.When the operation is finished,
callbackwill be called. You can then callremove_finish()to get the result of the operation.Added in version 2.16.
- Parameters:
types –
WebsiteDataTypeswebsite_data – a
ListofWebsiteDatacancellable – a
CancellableorNoneto ignorecallback – a
AsyncReadyCallbackto call when the request is satisfieduser_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
FaviconDatabaseofmanageris closed and its reference removed, soget_favicon_database()will returnNone. If website icons are enabled again, a newFaviconDatabasewill 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
WebsiteDataManageris ephemeral. An ephemeralWebsiteDataManagerhandles all websites data as non-persistent, and nothing will be written to the client storage. Note that if you create an ephemeralWebsiteDataManagerall 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.