Gio.ProxyResolver

g GObject.GInterface GObject.GInterface Gio.ProxyResolver Gio.ProxyResolver GObject.GInterface->Gio.ProxyResolver

Implementations:

Gio.SimpleProxyResolver

Methods

class

get_default ()

is_supported ()

lookup (uri, cancellable)

lookup_async (uri, cancellable, callback, *user_data)

lookup_finish (result)

Virtual Methods

do_is_supported ()

do_lookup (uri, cancellable)

do_lookup_async (uri, cancellable, callback, *user_data)

do_lookup_finish (result)

Properties

None

Signals

None

Fields

None

Class Details

class Gio.ProxyResolver
Bases:

GObject.GInterface

Structure:

Gio.ProxyResolverInterface

GProxyResolver provides synchronous and asynchronous network proxy resolution. GProxyResolver is used within [class`Gio`.SocketClient] through the method [method`Gio`.SocketConnectable.proxy_enumerate].

Implementations of GProxyResolver based on libproxy and GNOME settings can be found in glib-networking. GIO comes with an implementation for use inside Flatpak portals.

New in version 2.26.

classmethod get_default()[source]
Returns:

the default Gio.ProxyResolver, which will be a dummy object if no proxy resolver is available

Return type:

Gio.ProxyResolver

Gets the default Gio.ProxyResolver for the system.

New in version 2.26.

is_supported()[source]
Returns:

True if self is supported.

Return type:

bool

Checks if self can be used on this system. (This is used internally; Gio.ProxyResolver.get_default() will only return a proxy resolver that returns True for this method.)

New in version 2.26.

lookup(uri, cancellable)[source]
Parameters:
Raises:

GLib.Error

Returns:

A None-terminated array of proxy URIs. Must be freed with GLib.strfreev().

Return type:

[str]

Looks into the system proxy configuration to determine what proxy, if any, to use to connect to uri. The returned proxy URIs are of the form <protocol>://[user[:password]@]host[:port] or direct://, where <protocol> could be http, rtsp, socks or other proxying protocol.

If you don’t know what network protocol is being used on the socket, you should use none as the URI protocol. In this case, the resolver might still return a generic proxy type (such as SOCKS), but would not return protocol-specific proxy types (such as http).

direct:// is used when no proxy is needed. Direct connection should not be attempted unless it is part of the returned array of proxies.

New in version 2.26.

lookup_async(uri, cancellable, callback, *user_data)[source]
Parameters:

Asynchronous lookup of proxy. See Gio.ProxyResolver.lookup() for more details.

New in version 2.26.

lookup_finish(result)[source]
Parameters:

result (Gio.AsyncResult) – the result passed to your Gio.AsyncReadyCallback

Raises:

GLib.Error

Returns:

A None-terminated array of proxy URIs. Must be freed with GLib.strfreev().

Return type:

[str]

Call this function to obtain the array of proxy URIs when Gio.ProxyResolver.lookup_async() is complete. See Gio.ProxyResolver.lookup() for more details.

New in version 2.26.

do_is_supported() virtual
Returns:

True if resolver is supported.

Return type:

bool

Checks if resolver can be used on this system. (This is used internally; Gio.ProxyResolver.get_default() will only return a proxy resolver that returns True for this method.)

New in version 2.26.

do_lookup(uri, cancellable) virtual
Parameters:
Returns:

A None-terminated array of proxy URIs. Must be freed with GLib.strfreev().

Return type:

[str]

Looks into the system proxy configuration to determine what proxy, if any, to use to connect to uri. The returned proxy URIs are of the form <protocol>://[user[:password]@]host[:port] or direct://, where <protocol> could be http, rtsp, socks or other proxying protocol.

If you don’t know what network protocol is being used on the socket, you should use none as the URI protocol. In this case, the resolver might still return a generic proxy type (such as SOCKS), but would not return protocol-specific proxy types (such as http).

direct:// is used when no proxy is needed. Direct connection should not be attempted unless it is part of the returned array of proxies.

New in version 2.26.

do_lookup_async(uri, cancellable, callback, *user_data) virtual
Parameters:

Asynchronous lookup of proxy. See Gio.ProxyResolver.lookup() for more details.

New in version 2.26.

do_lookup_finish(result) virtual
Parameters:

result (Gio.AsyncResult) – the result passed to your Gio.AsyncReadyCallback

Returns:

A None-terminated array of proxy URIs. Must be freed with GLib.strfreev().

Return type:

[str]

Call this function to obtain the array of proxy URIs when Gio.ProxyResolver.lookup_async() is complete. See Gio.ProxyResolver.lookup() for more details.

New in version 2.26.