RequestException (exceptions.py)

requests · auth, exception-hierarchy, error-types, http-errors, infra

requests.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Requests' exceptions.

"""
requests.exceptions
~~~~~~~~~~~~~~~~~~~

This module contains the set of Requests' exceptions.
"""

from __future__ import annotations

from typing import TYPE_CHECKING, Any

from urllib3.exceptions import HTTPError as BaseHTTPError

from .compat import JSONDecodeError as CompatJSONDecodeError

if TYPE_CHECKING:
    from .models import PreparedRequest, Request, Response


class RequestException(IOError):
    """There was an ambiguous exception that occurred while handling your
    request.
    """

    response: Response | None
    request: Request | PreparedRequest | None

    def __init__(self, *args: Any, **kwargs: Any) -> None:
        """Initialize RequestException with `request` and `response` objects."""
        response: Response | None = kwargs.pop("response", None)
        se

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key