summaryrefslogtreecommitdiffstats
path: root/Lib/urllib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/urllib')
-rw-r--r--Lib/urllib/error.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/urllib/error.py b/Lib/urllib/error.py
index d05f850..c1dfc40 100644
--- a/Lib/urllib/error.py
+++ b/Lib/urllib/error.py
@@ -55,6 +55,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):