diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2011-12-03 14:39:58 (GMT) |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2011-12-03 14:39:58 (GMT) |
commit | 0612e8c2a25909788a8df7482670fd473e0f51ba (patch) | |
tree | 869a0361c87930be698091e9bddcbb0f78936341 /Lib/urllib/error.py | |
parent | c9b644eac28614ae74afb52432ad71d7077e8add (diff) | |
parent | aa204dbe9c83302781f7b9d7df6db225b3661f9e (diff) | |
download | cpython-0612e8c2a25909788a8df7482670fd473e0f51ba.zip cpython-0612e8c2a25909788a8df7482670fd473e0f51ba.tar.gz cpython-0612e8c2a25909788a8df7482670fd473e0f51ba.tar.bz2 |
Merged fix for #13211 from 3.2
Diffstat (limited to 'Lib/urllib/error.py')
-rw-r--r-- | Lib/urllib/error.py | 6 |
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): |