Skip to content

wreq.proxy

Proxy settings for HTTP, HTTPS, and SOCKS proxies.

wreq.proxy

ProxyConfig typed-dict

Bases: TypedDict

Source code in python/wreq/proxy.py
class ProxyConfig(TypedDict):
    username: NotRequired[str]
    r"""Username for proxy authentication."""

    password: NotRequired[str]
    r"""Password for proxy authentication."""

    custom_http_auth: NotRequired[str]
    r"""Custom HTTP proxy authentication header value."""

    custom_http_headers: NotRequired[Mapping[str, str] | HeaderMap]
    r"""Custom HTTP proxy headers."""

    exclusion: NotRequired[str]
    r"""List of domains to exclude from proxying."""

__init__

__init__(*, username=..., password=..., custom_http_auth=..., custom_http_headers=..., exclusion=...)

Parameters:

Name Type Description Default
username str

Username for proxy authentication.

...
password str

Password for proxy authentication.

...
custom_http_auth str

Custom HTTP proxy authentication header value.

...
custom_http_headers Mapping[str, str] | HeaderMap

Custom HTTP proxy headers.

...
exclusion str

List of domains to exclude from proxying.

...

Proxy

A proxy server for a request. Supports HTTP, HTTPS, SOCKS4, SOCKS4a, SOCKS5, and SOCKS5h protocols.

Source code in python/wreq/proxy.py
@final
class Proxy:
    r"""
    A proxy server for a request.
    Supports HTTP, HTTPS, SOCKS4, SOCKS4a, SOCKS5, and SOCKS5h protocols.
    """

    @staticmethod
    def http(url: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
        r"""
        Creates a new HTTP proxy.

        This method sets up a proxy server for HTTP requests.

        # Examples

        ```python
        import wreq

        proxy = wreq.Proxy.http("http://proxy.example.com")
        ```
        """
        ...

    @staticmethod
    def https(url: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
        r"""
        Creates a new HTTPS proxy.

        This method sets up a proxy server for HTTPS requests.

        # Examples

        ```python
        import wreq

        proxy = wreq.Proxy.https("https://proxy.example.com")
        ```
        """
        ...

    @staticmethod
    def all(url: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
        r"""
        Creates a new proxy for all protocols.

        This method sets up a proxy server for all types of requests (HTTP, HTTPS, etc.).

        # Examples

        ```python
        import wreq

        proxy = wreq.Proxy.all("https://proxy.example.com")
        ```
        """
        ...

    @staticmethod
    def unix(path: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
        r"""
        Creates a new UNIX socket proxy.

        This method sets up a proxy server using a UNIX domain socket.

        # Examples

        ```python
        import wreq

        proxy = wreq.Proxy.unix("/var/run/docker.sock")
        ```
        """
        ...

    def __str__(self) -> str: ...

http staticmethod

http(url, *, username=..., password=..., custom_http_auth=..., custom_http_headers=..., exclusion=...)

Creates a new HTTP proxy.

This method sets up a proxy server for HTTP requests.

Examples
import wreq

proxy = wreq.Proxy.http("http://proxy.example.com")

Parameters:

Name Type Description Default
username str

Username for proxy authentication.

...
password str

Password for proxy authentication.

...
custom_http_auth str

Custom HTTP proxy authentication header value.

...
custom_http_headers Mapping[str, str] | HeaderMap

Custom HTTP proxy headers.

...
exclusion str

List of domains to exclude from proxying.

...
Source code in python/wreq/proxy.py
@staticmethod
def http(url: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
    r"""
    Creates a new HTTP proxy.

    This method sets up a proxy server for HTTP requests.

    # Examples

    ```python
    import wreq

    proxy = wreq.Proxy.http("http://proxy.example.com")
    ```
    """
    ...

https staticmethod

https(url, *, username=..., password=..., custom_http_auth=..., custom_http_headers=..., exclusion=...)

Creates a new HTTPS proxy.

This method sets up a proxy server for HTTPS requests.

Examples
import wreq

proxy = wreq.Proxy.https("https://proxy.example.com")

Parameters:

Name Type Description Default
username str

Username for proxy authentication.

...
password str

Password for proxy authentication.

...
custom_http_auth str

Custom HTTP proxy authentication header value.

...
custom_http_headers Mapping[str, str] | HeaderMap

Custom HTTP proxy headers.

...
exclusion str

List of domains to exclude from proxying.

...
Source code in python/wreq/proxy.py
@staticmethod
def https(url: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
    r"""
    Creates a new HTTPS proxy.

    This method sets up a proxy server for HTTPS requests.

    # Examples

    ```python
    import wreq

    proxy = wreq.Proxy.https("https://proxy.example.com")
    ```
    """
    ...

all staticmethod

all(url, *, username=..., password=..., custom_http_auth=..., custom_http_headers=..., exclusion=...)

Creates a new proxy for all protocols.

This method sets up a proxy server for all types of requests (HTTP, HTTPS, etc.).

Examples
import wreq

proxy = wreq.Proxy.all("https://proxy.example.com")

Parameters:

Name Type Description Default
username str

Username for proxy authentication.

...
password str

Password for proxy authentication.

...
custom_http_auth str

Custom HTTP proxy authentication header value.

...
custom_http_headers Mapping[str, str] | HeaderMap

Custom HTTP proxy headers.

...
exclusion str

List of domains to exclude from proxying.

...
Source code in python/wreq/proxy.py
@staticmethod
def all(url: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
    r"""
    Creates a new proxy for all protocols.

    This method sets up a proxy server for all types of requests (HTTP, HTTPS, etc.).

    # Examples

    ```python
    import wreq

    proxy = wreq.Proxy.all("https://proxy.example.com")
    ```
    """
    ...

unix staticmethod

unix(path, *, username=..., password=..., custom_http_auth=..., custom_http_headers=..., exclusion=...)

Creates a new UNIX socket proxy.

This method sets up a proxy server using a UNIX domain socket.

Examples
import wreq

proxy = wreq.Proxy.unix("/var/run/docker.sock")

Parameters:

Name Type Description Default
username str

Username for proxy authentication.

...
password str

Password for proxy authentication.

...
custom_http_auth str

Custom HTTP proxy authentication header value.

...
custom_http_headers Mapping[str, str] | HeaderMap

Custom HTTP proxy headers.

...
exclusion str

List of domains to exclude from proxying.

...
Source code in python/wreq/proxy.py
@staticmethod
def unix(path: str, **kwargs: Unpack[ProxyConfig]) -> "Proxy":
    r"""
    Creates a new UNIX socket proxy.

    This method sets up a proxy server using a UNIX domain socket.

    # Examples

    ```python
    import wreq

    proxy = wreq.Proxy.unix("/var/run/docker.sock")
    ```
    """
    ...