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 passingNone
as 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.NetworkSession
with a persistentWebKit.WebsiteDataManager
. The parameters data_directory and cache_directory will be used as construct properties of theWebKit.WebsiteDataManager
of the network session. Note that ifNone
is passed, the default directory will be passed toWebKit.WebsiteDataManager
so 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.NetworkSession
with 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.MemoryPressureSettings
to be used by the network process created by any instance ofWebKit.NetworkSession
after 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
None
as the value of settings.New in version 2.40.
- allow_tls_certificate_for_host(certificate, host)¶
- Parameters:
certificate (
Gio.TlsCertificate
) – aGio.TlsCertificate
host (
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.Download
representing 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.WebView
useWebKit.WebView.download_uri
() instead.New in version 2.40.
- get_cookie_manager()¶
- Returns:
- Return type:
Get the
WebKit.CookieManager
of 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.Cancellable
orNone
) – aGio.Cancellable
orNone
to ignorecallback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously get the list of
WebKit.ITPThirdParty
seen for self.Every
WebKit.ITPThirdParty
contains the list ofWebKit.ITPFirstParty
under 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.List
ofWebKit.ITPThirdParty
. You must free theGLib.List
with g_list_free() and unref theWebKit.ITPThirdParty
s 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.WebsiteDataManager
of self.New in version 2.40.
- is_ephemeral()¶
-
Get whether self is ephemeral. A
WebKit.NetworkSession
is ephemeral when itsWebKit.WebsiteDataManager
is ephemeral. SeeWebKit.WebsiteDataManager
:is-ephemeral
for 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_PARTY
is ignored andWebKit.CookieAcceptPolicy.ALWAYS
is 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.NetworkProxyMode
proxy_settings (
WebKit.NetworkProxySettings
orNone
) – aWebKit.NetworkProxySettings
, orNone
Set the network proxy settings to be used by connections started in self session.
By default
WebKit.NetworkProxyMode.DEFAULT
is 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_PROXY
to make sure no proxies are used at all, orWebKit.NetworkProxyMode.CUSTOM
to provide your own proxy settings. When proxy_mode isWebKit.NetworkProxyMode.CUSTOM
proxy_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.Download
associated 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.WebsiteDataManager
for the session.New in version 2.40.