Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue15701

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:AttributeError from HTTPError when using digest auth
Type:crashStage:
Components:Library (Lib)Versions:Python 3.3, Python 3.4, Python 2.7
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: orsenthilNosy List: berker.peksag, orsenthil, python-dev, scjody
Priority:normalKeywords:patch

Created on2012-08-16 20:35 byscjody, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
reproducer.pyscjody,2012-08-16 20:35reproducer
issue15701.diffberker.peksag,2012-12-07 12:30review
Issue1571.patchorsenthil,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.headersAttributeError: 'HTTPError' object has no attribute 'headers'$ python --versionPython 2.6.6
msg169511 -(view)Author: Berker Peksag (berker.peksag)*(Python committer)Date: 2012-08-31 09:13
Python 2.6 is now in security-fix-only mode.
msg169560 -(view)Author: Senthil Kumaran (orsenthil)*(Python committer)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.hdrsI 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)*(Python committer)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)(Python triager)Date: 2012-12-10 10:09
New changesetad1c1164f68b by Senthil Kumaran in branch 'default':FixIssue15701 : add .headers attribute to urllib.error.HTTPErrorhttp://hg.python.org/cpython/rev/ad1c1164f68b
msg177998 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2012-12-23 17:13
New changeset3046bfea59f3 by Senthil Kumaran in branch '2.7':FixIssue15701 - HTTPError info method call raises AttributeError. Fix that to return headers correctlyhttp://hg.python.org/cpython/rev/3046bfea59f3New changeset919ebf74bfdb by Senthil Kumaran in branch '3.2':FixIssue15701 - HTTPError info method call raises AttributeError. Fix that to return headers correctlyhttp://hg.python.org/cpython/rev/919ebf74bfdbNew changeseta15109398294 by Senthil Kumaran in branch '3.3':merge from 3.2http://hg.python.org/cpython/rev/a15109398294
msg177999 -(view)Author: Senthil Kumaran (orsenthil)*(Python committer)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)(Python triager)Date: 2014-03-13 16:01
New changeset361c10d06b9c by R David Murray in branch 'default':whatsnew: HTTPError.headers (#15701).http://hg.python.org/cpython/rev/361c10d06b9c
History
DateUserActionArgs
2022-04-11 14:57:34adminsetgithub: 59906
2014-03-13 16:01:10python-devsetmessages: +msg213410
2012-12-23 17:14:40orsenthilsetstatus: open -> closed
resolution: fixed
messages: +msg177999
2012-12-23 17:13:57python-devsetmessages: +msg177998
2012-12-10 10:09:47python-devsetnosy: +python-dev
messages: +msg177271
2012-12-10 09:35:36orsenthilsetfiles: +Issue1571.patch

messages: +msg177270
2012-12-07 12:30:36berker.peksagsetfiles: +issue15701.diff
keywords: +patch
versions: + Python 3.3, Python 3.4
2012-08-31 16:49:35orsenthilsetassignee:orsenthil

messages: +msg169560
nosy: +orsenthil
2012-08-31 09:13:29berker.peksagsetversions: + Python 2.7, - Python 2.6
nosy: +berker.peksag

messages: +msg169511

components: + Library (Lib)
2012-08-16 20:35:57scjodycreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp