:right-sidebar: True ProxyResolver =================================================================== .. currentmodule:: gi.repository.Gio .. versionadded:: 2.26 .. class:: ProxyResolver(*args, **kwargs) :no-contents-entry: Implementations: :class:`~gi.repository.Gio.SimpleProxyResolver` ``GProxyResolver`` provides synchronous and asynchronous network proxy resolution. ``GProxyResolver`` is used within :obj:`~gi.repository.Gio.SocketClient` through the method :obj:`~gi.repository.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. Methods ------- .. rst-class:: interim-class .. class:: ProxyResolver :no-index: .. classmethod:: get_default() -> ~gi.repository.Gio.ProxyResolver Gets the default :obj:`~gi.repository.Gio.ProxyResolver` for the system. .. versionadded:: 2.26 .. method:: is_supported() -> bool Checks if ``resolver`` can be used on this system. (This is used internally; :func:`~gi.repository.Gio.ProxyResolver.get_default` will only return a proxy resolver that returns :const:`True` for this method.) .. versionadded:: 2.26 .. method:: lookup(uri: str, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> list[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 ``://[user[:password]@]host[:port]`` or ``direct://``\, where ```` 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. .. versionadded:: 2.26 :param uri: a URI representing the destination to connect to :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: lookup_async(uri: str, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronous lookup of proxy. See :func:`~gi.repository.Gio.ProxyResolver.lookup` for more details. .. versionadded:: 2.26 :param uri: a URI representing the destination to connect to :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call after resolution completes :param user_data: data for ``callback`` .. method:: lookup_finish(result: ~gi.repository.Gio.AsyncResult) -> list[str] Call this function to obtain the array of proxy URIs when :func:`~gi.repository.Gio.ProxyResolver.lookup_async` is complete. See :func:`~gi.repository.Gio.ProxyResolver.lookup` for more details. .. versionadded:: 2.26 :param result: the result passed to your :obj:`~gi.repository.Gio.AsyncReadyCallback` Virtual Methods --------------- .. rst-class:: interim-class .. class:: ProxyResolver :no-index: .. method:: do_is_supported() -> bool Checks if ``resolver`` can be used on this system. (This is used internally; :func:`~gi.repository.Gio.ProxyResolver.get_default` will only return a proxy resolver that returns :const:`True` for this method.) .. versionadded:: 2.26 .. method:: do_lookup(uri: str, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> list[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 ``://[user[:password]@]host[:port]`` or ``direct://``\, where ```` 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. .. versionadded:: 2.26 :param uri: a URI representing the destination to connect to :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` .. method:: do_lookup_async(uri: str, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronous lookup of proxy. See :func:`~gi.repository.Gio.ProxyResolver.lookup` for more details. .. versionadded:: 2.26 :param uri: a URI representing the destination to connect to :param cancellable: a :obj:`~gi.repository.Gio.Cancellable`\, or :const:`None` :param callback: callback to call after resolution completes :param user_data: data for ``callback`` .. method:: do_lookup_finish(result: ~gi.repository.Gio.AsyncResult) -> list[str] Call this function to obtain the array of proxy URIs when :func:`~gi.repository.Gio.ProxyResolver.lookup_async` is complete. See :func:`~gi.repository.Gio.ProxyResolver.lookup` for more details. .. versionadded:: 2.26 :param result: the result passed to your :obj:`~gi.repository.Gio.AsyncReadyCallback`