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
- 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 pasttimespan
.If
timespan
is 0, all website data will be removed.When the operation is finished,
callback
will 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
timespan
is nonzero. This behavior may change in the future.Added in version 2.16.
- Parameters:
types –
WebsiteDataTypes
timespan – a
TimeSpan
cancellable – a
Cancellable
orNone
to ignorecallback – a
AsyncReadyCallback
to 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
- fetch(types: WebsiteDataTypes, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None
Asynchronously get the list of
WebsiteData
for the giventypes
.When the operation is finished,
callback
will be called. You can then callfetch_finish()
to get the result of the operation.Added in version 2.16.
- Parameters:
types –
WebsiteDataTypes
cancellable – a
Cancellable
orNone
to ignorecallback – a
AsyncReadyCallback
to 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
FaviconDatabase
ofmanager
.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 formanager
.Every
ITPThirdParty
contains the list ofITPFirstParty
under which it has been seen.When the operation is finished,
callback
will be called. You can then callget_itp_summary_finish()
to get the result of the operation.Added in version 2.30.
- Parameters:
cancellable – a
Cancellable
orNone
to ignorecallback – a
AsyncReadyCallback
to 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
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 givenwebsite_data
list. Useclear()
if you want to remove the website data for all sites.When the operation is finished,
callback
will be called. You can then callremove_finish()
to get the result of the operation.Added in version 2.16.
- Parameters:
types –
WebsiteDataTypes
website_data – a
List
ofWebsiteData
cancellable – a
Cancellable
orNone
to ignorecallback – a
AsyncReadyCallback
to 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
FaviconDatabase
ofmanager
is closed and its reference removed, soget_favicon_database()
will returnNone
. If website icons are enabled again, a newFaviconDatabase
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 ephemeralWebsiteDataManager
handles all websites data as non-persistent, and nothing will be written to the client storage. Note that if you create an ephemeralWebsiteDataManager
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.