Issue15701
Created on 2012-08-16 20:35 by scjody, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| reproducer.py | scjody, 2012-08-16 20:35 | reproducer | ||
| issue15701.diff | berker.peksag, 2012-12-07 12:30 | review | ||
| Issue1571.patch | orsenthil, 2012-12-10 09:35 | |||
| Messages (8) | |||
|---|---|---|---|
| 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 <module>
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 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:34 | admin | set | github: 59906 |
| 2014-03-13 16:01:10 | python-dev | set | messages: + msg213410 |
| 2012-12-23 17:14:40 | orsenthil | set | status: open -> closed resolution: fixed messages: + msg177999 |
| 2012-12-23 17:13:57 | python-dev | set | messages: + msg177998 |
| 2012-12-10 10:09:47 | python-dev | set | nosy:
+ python-dev messages: + msg177271 |
| 2012-12-10 09:35:36 | orsenthil | set | files:
+ Issue1571.patch messages: + msg177270 |
| 2012-12-07 12:30:36 | berker.peksag | set | files:
+ issue15701.diff keywords: + patch versions: + Python 3.3, Python 3.4 |
| 2012-08-31 16:49:35 | orsenthil | set | assignee: orsenthil |
| 2012-08-31 09:13:29 | berker.peksag | set | versions:
+ Python 2.7, - Python 2.6 nosy: + berker.peksag messages: + msg169511 components: + Library (Lib) |
| 2012-08-16 20:35:57 | scjody | create | |

