mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #13211: Add .reason attribute to HTTPError to implement parent class (URLError) interface.
This commit is contained in:
parent
a90e364ea5
commit
aa204dbe9c
2 changed files with 17 additions and 0 deletions
|
@ -52,6 +52,12 @@ class HTTPError(URLError, urllib.response.addinfourl):
|
|||
def __str__(self):
|
||||
return 'HTTP Error %s: %s' % (self.code, self.msg)
|
||||
|
||||
# since URLError specifies a .reason attribute, HTTPError should also
|
||||
# provide this attribute. See issue13211 for discussion.
|
||||
@property
|
||||
def reason(self):
|
||||
return self.msg
|
||||
|
||||
# exception raised when downloaded size does not match content-length
|
||||
class ContentTooShortError(URLError):
|
||||
def __init__(self, message, content):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue