[Patches] [ python-Patches-1117588 ] urllib2 .getheaders attribute
error
SourceForge.net
noreply at sourceforge.net
Thu Mar 24 22:15:46 CET 2005
Patches item #1117588, was opened at 2005-02-06 19:18
Message generated for change (Comment added) made by fdrake
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1117588&group_id=5470
Category: Library (Lib)
Group: Python 2.4
>Status: Closed
>Resolution: Works For Me
Priority: 5
Submitted By: Wummel (calvin)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 .getheaders attribute error
Initial Comment:
The headers arguments to all methods are dictionaries,
however the http_error_302 method calls
headers.getheaders() which results in an attribute error.
The attached patch against current CVS fixes this by
using headers.get() instead of .getheaders().
----------------------------------------------------------------------
>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2005-03-24 16:15
Message:
Logged In: YES
user_id=3066
Closing based on follow-up comments.
----------------------------------------------------------------------
Comment By: Wummel (calvin)
Date: 2005-03-08 05:33
Message:
Logged In: YES
user_id=9205
Hm, I _could_ reproduce this, but not anymore. I should have
saved the test program :/. Well, you can close this bug. If
I encounter this problem again I will post a little test script.
----------------------------------------------------------------------
Comment By: John J Lee (jjlee)
Date: 2005-02-19 20:45
Message:
Logged In: YES
user_id=261020
I can't see where your AttributeError is coming from.
Thankyou very much for the bug report, but *please* supply
some means of reproducing the problem!
> The headers arguments to all methods are dictionaries,
They are in fact always httplib.HTTPMessage instances, as
far as I can see. That class inherits a .getheaders()
method from rfc822.Message. (And FWIW, so far as I can see,
the type of the "hdrs" arguments to the .http_error_*()
handler methods are not documented.)
Moreover, .getheaders() and .get() don't mean the same thing
in general: HTTPMessage.getheaders(name)[0] preserves header
ordering information, where eg. dict.get(name) does not.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1117588&group_id=5470
More information about the Patches
mailing list