mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Add constructor for HTTPError in urllib2/urllib.error (#2373)
It seems that code using HTTPError previously worked by accident because we used to accept arbitrary keyword arguments when instantiating BaseException, or any subclass of BaseException (see https://github.com/python/typeshed/pull/2348). This commit adds in the correct constructor (which also lets the user specify the arguments in keyword-argument form). Note: I'm not very familiar with the urllib libraries, so I opted to just add the signature and leave it up to somebody else to fill in the types.
This commit is contained in:
committed by
Jelle Zijlstra
parent
5b2c8dc883
commit
bc8d68cd34
@@ -12,6 +12,7 @@ class URLError(IOError):
|
||||
class HTTPError(URLError, addinfourl):
|
||||
code = ... # type: int
|
||||
headers = ... # type: Dict[str, str]
|
||||
def __init__(self, url, code, msg, hdrs, fp) -> None: ...
|
||||
|
||||
class Request(object):
|
||||
host = ... # type: str
|
||||
|
||||
@@ -8,4 +8,5 @@ class URLError(IOError):
|
||||
class HTTPError(URLError, addinfourl):
|
||||
code = ... # type: int
|
||||
headers = ... # type: Dict[str, str]
|
||||
def __init__(self, url, code, msg, hdrs, fp) -> None: ...
|
||||
class ContentTooShortError(URLError): ...
|
||||
|
||||
Reference in New Issue
Block a user