Skip to content

Commit

Permalink
[requests] Allow HTTPError.response to be None (#10875)
Browse files Browse the repository at this point in the history
This aligns with the definition in requests, but means that user code might
need additional assertions to ensure that `HTTPError.response` is not `None`.
  • Loading branch information
ubersan committed Oct 13, 2023
1 parent f3506eb commit e92bfcb
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions stubs/requests/requests/exceptions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ class RequestException(OSError):

class InvalidJSONError(RequestException): ...
class JSONDecodeError(InvalidJSONError): ...

class HTTPError(RequestException):
request: Request | PreparedRequest | None
response: Response
def __init__(self, *args: object, request: Request | PreparedRequest | None = ..., response: Response) -> None: ...

class HTTPError(RequestException): ...
class ConnectionError(RequestException): ...
class ProxyError(ConnectionError): ...
class SSLError(ConnectionError): ...
Expand Down

0 comments on commit e92bfcb

Please sign in to comment.