Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions stubs/requests/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen
requests.packages.urllib3.connectionpool.HTTPResponse.__init__
requests.packages.urllib3.connectionpool.HTTPSConnection.__init__
requests.packages.urllib3.connectionpool.HTTPSConnectionPool.__init__
requests.packages.urllib3.connectionpool.ProxyError.__init__
requests.packages.urllib3.connectionpool.RequestMethods.request_encode_url
requests.packages.urllib3.connectionpool.Retry.is_forced_retry
requests.packages.urllib3.connectionpool.Retry.sleep
requests.packages.urllib3.connectionpool.VerifiedHTTPSConnection.__init__
requests.packages.urllib3.connectionpool.VerifiedHTTPSConnection.set_cert
requests.packages.urllib3.exceptions.ProxyError.__init__
requests.packages.urllib3.fields.RequestField.__init__
requests.packages.urllib3.fields.RequestField.from_tuples
requests.packages.urllib3.filepost.RequestField.__init__
Expand Down
62 changes: 47 additions & 15 deletions stubs/requests/requests/packages/urllib3/exceptions.pyi
Original file line number Diff line number Diff line change
@@ -1,50 +1,82 @@
from typing import Any
from email.errors import MessageDefect
from http.client import IncompleteRead as httplib_IncompleteRead
from typing import Any, Callable

from requests.packages.urllib3.connectionpool import ConnectionPool
from requests.packages.urllib3.util.retry import Retry

class HTTPError(Exception): ...
class HTTPWarning(Warning): ...

_TYPE_REDUCE_RESULT = tuple[Callable[..., Any], tuple[Any, ...]]

class PoolError(HTTPError):
pool: Any
def __init__(self, pool, message) -> None: ...
def __reduce__(self): ...
def __init__(self, pool: ConnectionPool, message: str) -> None: ...
def __reduce__(self) -> _TYPE_REDUCE_RESULT: ...

class RequestError(PoolError):
url: Any
def __init__(self, pool, url, message) -> None: ...
def __reduce__(self): ...
def __init__(self, pool: ConnectionPool, url: str, message: str) -> None: ...
def __reduce__(self) -> _TYPE_REDUCE_RESULT: ...

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: ...
def __init__(self, pool: ConnectionPool, url: str, reason: Exception | None = ...) -> None: ...

class HostChangedError(RequestError):
retries: Any
def __init__(self, pool, url, retries=...) -> None: ...
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: ...
def __init__(self, location: str) -> None: ...

class URLSchemeUnknown(LocationValueError):
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 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: ...
def __repr__(self) -> str: ...

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): ...