Skip to content

Commit b532f6b

Browse files
authored
Add attributes to urllib errors (#14332)
1 parent 88362fe commit b532f6b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stdlib/urllib/error.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ __all__ = ["URLError", "HTTPError", "ContentTooShortError"]
66

77
class URLError(OSError):
88
reason: str | BaseException
9+
# The `filename` attribute only exists if it was provided to `__init__` and wasn't `None`.
10+
filename: str
911
def __init__(self, reason: str | BaseException, filename: str | None = None) -> None: ...
1012

1113
class HTTPError(URLError, addinfourl):
@@ -16,6 +18,9 @@ class HTTPError(URLError, addinfourl):
1618
@property
1719
def reason(self) -> str: ... # type: ignore[override]
1820
code: int
21+
msg: str
22+
hdrs: Message
23+
fp: IO[bytes]
1924
def __init__(self, url: str, code: int, msg: str, hdrs: Message, fp: IO[bytes] | None) -> None: ...
2025

2126
class ContentTooShortError(URLError):

0 commit comments

Comments
 (0)