[Patches] [ python-Patches-1117588 ] urllib2 .getheaders attribute
error
SourceForge.net
noreply at sourceforge.net
Sun Feb 20 02:45:27 CET 2005
Patches item #1117588, was opened at 2005-02-07 00:18
Message generated for change (Comment added) made by jjlee
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: Open
Resolution: None
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: John J Lee (jjlee)
Date: 2005-02-20 01: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