SimpleProxyResolver#

Added in version 2.36.

class SimpleProxyResolver(**properties: Any)#

Superclasses: Object

Implemented Interfaces: ProxyResolver

GSimpleProxyResolver is a simple ProxyResolver implementation that handles a single default proxy, multiple URI-scheme-specific proxies, and a list of hosts that proxies should not be used for.

GSimpleProxyResolver is never the default proxy resolver, but it can be used as the base class for another proxy resolver implementation, or it can be created and used manually, such as with set_proxy_resolver.

Methods#

class SimpleProxyResolver
new(default_proxy: str | None = None, ignore_hosts: Sequence[str] | None = None) ProxyResolver#

Creates a new SimpleProxyResolver. See SimpleProxyResolver:default-proxy and SimpleProxyResolver:ignore-hosts for more details on how the arguments are interpreted.

Added in version 2.36.

Parameters:
  • default_proxy – the default proxy to use, eg “socks://192.168.1.1”

  • ignore_hosts – an optional list of hosts/IP addresses to not use a proxy for.

set_default_proxy(default_proxy: str | None = None) None#

Sets the default proxy on resolver, to be used for any URIs that don’t match SimpleProxyResolver:ignore-hosts or a proxy set via set_uri_proxy().

If default_proxy starts with “socks://”, SimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

Added in version 2.36.

Parameters:

default_proxy – the default proxy to use

set_ignore_hosts(ignore_hosts: Sequence[str]) None#

Sets the list of ignored hosts.

See SimpleProxyResolver:ignore-hosts for more details on how the ignore_hosts argument is interpreted.

Added in version 2.36.

Parameters:

ignore_hostsNone-terminated list of hosts/IP addresses to not use a proxy for

set_uri_proxy(uri_scheme: str, proxy: str) None#

Adds a URI-scheme-specific proxy to resolver; URIs whose scheme matches uri_scheme (and which don’t match SimpleProxyResolver:ignore-hosts) will be proxied via proxy.

As with SimpleProxyResolver:default-proxy, if proxy starts with “socks://”, SimpleProxyResolver will treat it as referring to all three of the socks5, socks4a, and socks4 proxy types.

Added in version 2.36.

Parameters:
  • uri_scheme – the URI scheme to add a proxy for

  • proxy – the proxy to use for uri_scheme

Properties#

class SimpleProxyResolver
props.default_proxy: str#

The type of the None singleton.

props.ignore_hosts: Sequence[str]#

The type of the None singleton.

Fields#

class SimpleProxyResolver
parent_instance#
priv#