WebKit.NetworkSession¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
w/co |
|||
w/co |
|||
r/w/co |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
This signal is emitted when a new download request is made. |
Fields¶
- Inherited:
Class Details¶
- class WebKit.NetworkSession(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Manages network configuration.
New in version 2.40.
- classmethod get_default()¶
- Returns:
- Return type:
Get the default network session. The default network session is created using
WebKit.NetworkSession.new() and passingNoneas data and cache directories.New in version 2.40.
- classmethod new(data_directory, cache_directory)¶
- Parameters:
- Returns:
the newly created
WebKit.NetworkSession- Return type:
Creates a new
WebKit.NetworkSessionwith a persistentWebKit.WebsiteDataManager. The parameters data_directory and cache_directory will be used as construct properties of theWebKit.WebsiteDataManagerof the network session. Note that ifNoneis passed, the default directory will be passed toWebKit.WebsiteDataManagerso thatWebKit.WebsiteDataManager.get_base_data_directory() andWebKit.WebsiteDataManager.get_base_cache_directory() always return a value for non ephemeral sessions.It must be passed as construct parameter of a
WebKit.WebView.New in version 2.40.
- classmethod new_ephemeral()¶
- Returns:
a new ephemeral
WebKit.NetworkSession.- Return type:
Creates a new
WebKit.NetworkSessionwith an ephemeralWebKit.WebsiteDataManager.New in version 2.40.
- classmethod set_memory_pressure_settings(settings)¶
- Parameters:
settings (
WebKit.MemoryPressureSettings) – aWebKit.MemoryPressureSettings.
Sets settings as the
WebKit.MemoryPressureSettings.Sets settings as the
WebKit.MemoryPressureSettingsto be used by the network process created by any instance ofWebKit.NetworkSessionafter this function is called.Be sure to call this function before creating any
WebKit.NetworkSession.The periodic check for used memory is disabled by default on network processes. This will be enabled only if custom settings have been set using this function. After that, in order to remove the custom settings and disable the periodic check, this function must be called passing
Noneas the value of settings.New in version 2.40.
- allow_tls_certificate_for_host(certificate, host)¶
- Parameters:
certificate (
Gio.TlsCertificate) – aGio.TlsCertificatehost (
str) – the host for which a certificate is to be allowed
Ignore further TLS errors on the host for the certificate present in info.
If host is an IPv6 address, it should not be surrounded by brackets. This expectation matches
GLib.Uri.get_host().New in version 2.40.
- download_uri(uri)¶
- Parameters:
uri (
str) – the URI to download- Returns:
a new
WebKit.Downloadrepresenting the download operation.- Return type:
Requests downloading of the specified URI string.
The download operation will not be associated to any
WebKit.WebView, if you are interested in starting a download from a particularWebKit.WebViewuseWebKit.WebView.download_uri() instead.New in version 2.40.
- get_cookie_manager()¶
- Returns:
- Return type:
Get the
WebKit.CookieManagerof self.New in version 2.40.
- get_itp_enabled()¶
-
Get whether Intelligent Tracking Prevention (ITP) is enabled or not.
New in version 2.40.
- get_itp_summary(cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.CancellableorNone) – aGio.CancellableorNoneto ignorecallback (
Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfieduser_data (
objectorNone) – the data to pass to callback function
Asynchronously get the list of
WebKit.ITPThirdPartyseen for self.Every
WebKit.ITPThirdPartycontains the list ofWebKit.ITPFirstPartyunder which it has been seen.When the operation is finished, callback will be called. You can then call
WebKit.NetworkSession.get_itp_summary_finish() to get the result of the operation.New in version 2.40.
- get_itp_summary_finish(result)¶
- Parameters:
result (
Gio.AsyncResult) – aGio.AsyncResult- Raises:
- Returns:
a
GLib.ListofWebKit.ITPThirdParty. You must free theGLib.Listwith g_list_free() and unref theWebKit.ITPThirdPartys withWebKit.ITPThirdParty.unref() when you’re done with them.- Return type:
Finish an asynchronous operation started with
WebKit.NetworkSession.get_itp_summary().New in version 2.40.
- get_persistent_credential_storage_enabled()¶
-
Get whether persistent credential storage is enabled or not.
See also
WebKit.NetworkSession.set_persistent_credential_storage_enabled().New in version 2.40.
- get_tls_errors_policy()¶
- Returns:
- Return type:
Get the TLS errors policy of self.
New in version 2.40.
- get_website_data_manager()¶
- Returns:
- Return type:
Get the
WebKit.WebsiteDataManagerof self.New in version 2.40.
- is_ephemeral()¶
-
Get whether self is ephemeral. A
WebKit.NetworkSessionis ephemeral when itsWebKit.WebsiteDataManageris ephemeral. SeeWebKit.WebsiteDataManager:is-ephemeralfor more details.New in version 2.40.
- prefetch_dns(hostname)¶
- Parameters:
hostname (
str) – a hostname to be resolved
Resolve the domain name of the given hostname in advance, so that if a URI of hostname is requested the load will be performed more quickly.
New in version 2.40.
- set_itp_enabled(enabled)¶
- Parameters:
enabled (
bool) – value to set
Enable or disable Intelligent Tracking Prevention (ITP).
When ITP is enabled resource load statistics are collected and used to decide whether to allow or block third-party cookies and prevent user tracking. Note that while ITP is enabled the accept policy
WebKit.CookieAcceptPolicy.NO_THIRD_PARTYis ignored andWebKit.CookieAcceptPolicy.ALWAYSis used instead. See also webkit_cookie_session_set_accept_policy().New in version 2.40.
- set_persistent_credential_storage_enabled(enabled)¶
- Parameters:
enabled (
bool) – value to set
Enable or disable persistent credential storage.
When enabled, which is the default for non-ephemeral sessions, the network process will try to read and write HTTP authentiacation credentials from persistent storage.
New in version 2.40.
- set_proxy_settings(proxy_mode, proxy_settings)¶
- Parameters:
proxy_mode (
WebKit.NetworkProxyMode) – aWebKit.NetworkProxyModeproxy_settings (
WebKit.NetworkProxySettingsorNone) – aWebKit.NetworkProxySettings, orNone
Set the network proxy settings to be used by connections started in self session.
By default
WebKit.NetworkProxyMode.DEFAULTis used, which means that the system settings will be used (Gio.ProxyResolver.get_default()). If you want to override the system default settings, you can either useWebKit.NetworkProxyMode.NO_PROXYto make sure no proxies are used at all, orWebKit.NetworkProxyMode.CUSTOMto provide your own proxy settings. When proxy_mode isWebKit.NetworkProxyMode.CUSTOMproxy_settings must be a validWebKit.NetworkProxySettings; otherwise, proxy_settings must beNone.New in version 2.40.
- set_tls_errors_policy(policy)¶
- Parameters:
policy (
WebKit.TLSErrorsPolicy) – aWebKit.TLSErrorsPolicy
Set the TLS errors policy of self as policy.
New in version 2.40.
Signal Details¶
- WebKit.NetworkSession.signals.download_started(network_session, download)¶
- Signal Name:
download-started- Flags:
- Parameters:
network_session (
WebKit.NetworkSession) – The object which received the signaldownload (
WebKit.Download) – theWebKit.Downloadassociated with this event
This signal is emitted when a new download request is made.
New in version 2.40.
Property Details¶
- WebKit.NetworkSession.props.cache_directory¶
- Name:
cache-directory- Type:
- Default Value:
- Flags:
The base caches directory used to create the
WebKit.WebsiteDataManager. IfNone, a default location will be used.New in version 2.40.
- WebKit.NetworkSession.props.data_directory¶
- Name:
data-directory- Type:
- Default Value:
- Flags:
The base data directory used to create the
WebKit.WebsiteDataManager. IfNone, a default location will be used.New in version 2.40.
- WebKit.NetworkSession.props.is_ephemeral¶
- Name:
is-ephemeral- Type:
- Default Value:
- Flags:
Whether to create an ephermeral
WebKit.WebsiteDataManagerfor the session.New in version 2.40.