msg168407 - (view) |
Author: Jody McIntyre (scjody) |
Date: 2012-08-16 20:35 |
I attempted to connect to a site using urllib2 and digest authentication and it raised an HTTPError (due to an incorrect username and password, which is expected). I attempted to run the info() method of the HTTPError to get more information, but it failed with an AttributeError (this is the bug). $ ./reproducer.py Traceback (most recent call last): File "./reproducer.py", line 16, in print e.info() File "/usr/lib/python2.6/urllib.py", line 987, in info return self.headers AttributeError: 'HTTPError' object has no attribute 'headers' $ python --version Python 2.6.6 |
|
|
msg169511 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2012-08-31 09:13 |
Python 2.6 is now in security-fix-only mode. |
|
|
msg169560 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2012-08-31 16:49 |
Okay, this is funny. first info is invoking addinfourl of urllib, which would return headers. But in urllib2, the headers are self.hdrs I would side with the documentation that info is advertised method for HTTPError object. In 2.7, I guess just docs could be improved. This problem would be the present in 3.x. |
|
|
msg177270 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2012-12-10 09:35 |
Even though 2.x is in security fix mode, this can be fixed by a overriding the base class's info method in the HTTPError class and returning the .hdrs attribute instead of .headers. |
|
|
msg177271 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-10 10:09 |
New changeset ad1c1164f68b by Senthil Kumaran in branch 'default': Fix Issue15701 : add .headers attribute to urllib.error.HTTPError http://hg.python.org/cpython/rev/ad1c1164f68b |
|
|
msg177998 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2012-12-23 17:13 |
New changeset 3046bfea59f3 by Senthil Kumaran in branch '2.7': Fix Issue15701 - HTTPError info method call raises AttributeError. Fix that to return headers correctly http://hg.python.org/cpython/rev/3046bfea59f3 New changeset 919ebf74bfdb by Senthil Kumaran in branch '3.2': Fix Issue15701 - HTTPError info method call raises AttributeError. Fix that to return headers correctly http://hg.python.org/cpython/rev/919ebf74bfdb New changeset a15109398294 by Senthil Kumaran in branch '3.3': merge from 3.2 http://hg.python.org/cpython/rev/a15109398294 |
|
|
msg177999 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2012-12-23 17:14 |
Okay. this is fixed in all versions of python. Sorry for the delay. |
|
|
msg213410 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2014-03-13 16:01 |
New changeset 361c10d06b9c by R David Murray in branch 'default': whatsnew: HTTPError.headers (#15701). http://hg.python.org/cpython/rev/361c10d06b9c |
|
|