diff --git a/stubs/urllib3/@tests/stubtest_allowlist.txt b/stubs/urllib3/@tests/stubtest_allowlist.txt index 2252b59a5..62961f894 100644 --- a/stubs/urllib3/@tests/stubtest_allowlist.txt +++ b/stubs/urllib3/@tests/stubtest_allowlist.txt @@ -23,13 +23,11 @@ urllib3.connectionpool.HTTPConnectionPool.__init__ urllib3.connectionpool.HTTPConnectionPool.urlopen urllib3.connectionpool.HTTPSConnection.__init__ urllib3.connectionpool.HTTPSConnectionPool.__init__ -urllib3.connectionpool.ProxyError.__init__ urllib3.connectionpool.RequestMethods.request_encode_url urllib3.connectionpool.Retry.is_forced_retry urllib3.connectionpool.Retry.sleep urllib3.connectionpool.VerifiedHTTPSConnection.__init__ urllib3.connectionpool.VerifiedHTTPSConnection.set_cert -urllib3.exceptions.ProxyError.__init__ urllib3.fields.RequestField.__init__ urllib3.fields.RequestField.from_tuples urllib3.filepost.RequestField.__init__ diff --git a/stubs/urllib3/urllib3/exceptions.pyi b/stubs/urllib3/urllib3/exceptions.pyi index ddb4e83ba..8c2090613 100644 --- a/stubs/urllib3/urllib3/exceptions.pyi +++ b/stubs/urllib3/urllib3/exceptions.pyi @@ -1,50 +1,87 @@ +from email.errors import MessageDefect +from http.client import IncompleteRead as httplib_IncompleteRead from typing import Any +from urllib3.connectionpool import ConnectionPool, HTTPResponse +from urllib3.util.retry import Retry + class HTTPError(Exception): ... class HTTPWarning(Warning): ... class PoolError(HTTPError): - pool: Any - def __init__(self, pool, message) -> None: ... - def __reduce__(self): ... + pool: ConnectionPool + def __init__(self, pool: ConnectionPool, message: str) -> None: ... class RequestError(PoolError): - url: Any - def __init__(self, pool, url, message) -> None: ... - def __reduce__(self): ... + url: str + def __init__(self, pool: ConnectionPool, url: str, message: str) -> None: ... class SSLError(HTTPError): ... -class ProxyError(HTTPError): ... + +class ProxyError(HTTPError): + original_error: Exception + def __init__(self, message: str, error: Exception, *args: Any) -> None: ... + class DecodeError(HTTPError): ... class ProtocolError(HTTPError): ... -ConnectionError: Any +ConnectionError = ProtocolError class MaxRetryError(RequestError): - reason: Any - def __init__(self, pool, url, reason=...) -> None: ... + reason: Exception | None + def __init__(self, pool: ConnectionPool, url: str, reason: Exception | None = ...) -> None: ... class HostChangedError(RequestError): - retries: Any - def __init__(self, pool, url, retries=...) -> None: ... + retries: Retry | int + def __init__(self, pool: ConnectionPool, url: str, retries: Retry | int = ...) -> None: ... class TimeoutStateError(HTTPError): ... class TimeoutError(HTTPError): ... class ReadTimeoutError(TimeoutError, RequestError): ... class ConnectTimeoutError(TimeoutError): ... +class NewConnectionError(ConnectTimeoutError, HTTPError): ... class EmptyPoolError(PoolError): ... class ClosedPoolError(PoolError): ... class LocationValueError(ValueError, HTTPError): ... class LocationParseError(LocationValueError): - location: Any - def __init__(self, location) -> None: ... + location: str + def __init__(self, location: str) -> None: ... + +class URLSchemeUnknown(LocationValueError): + scheme: str + def __init__(self, scheme: str) -> None: ... class ResponseError(HTTPError): - GENERIC_ERROR: Any - SPECIFIC_ERROR: Any + GENERIC_ERROR: str + SPECIFIC_ERROR: str class SecurityWarning(HTTPWarning): ... +class SubjectAltNameWarning(SecurityWarning): ... class InsecureRequestWarning(SecurityWarning): ... class SystemTimeWarning(SecurityWarning): ... class InsecurePlatformWarning(SecurityWarning): ... +class SNIMissingWarning(HTTPWarning): ... +class DependencyWarning(HTTPWarning): ... +class ResponseNotChunked(ProtocolError, ValueError): ... +class BodyNotHttplibCompatible(HTTPError): ... + +class IncompleteRead(HTTPError, httplib_IncompleteRead): + def __init__(self, partial: bytes, expected: int | None) -> None: ... + +class InvalidChunkLength(HTTPError, httplib_IncompleteRead): + response: HTTPResponse + length: bytes + def __init__(self, response: HTTPResponse, length: bytes) -> None: ... + +class InvalidHeader(HTTPError): ... + +class ProxySchemeUnknown(AssertionError, URLSchemeUnknown): + def __init__(self, scheme: str | None) -> None: ... + +class ProxySchemeUnsupported(ValueError): ... + +class HeaderParsingError(HTTPError): + def __init__(self, defects: list[MessageDefect], unparsed_data: str | bytes | None) -> None: ... + +class UnrewindableBodyError(HTTPError): ...