homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jjlee
Recipients frispete, jjlee, orsenthil
Date 2008年03月30日.14:56:49
SpamBayes Score 0.03224158
Marked as misclassified No
Message-id <1206889011.71.0.0201052837496.issue2275@psf.upfronthosting.co.za>
In-reply-to
Content
urllib2.Request.headers is, in practice, an undocumented public
interface. Did you run the tests? There is room for improvement here,
but not in the way you suggest.
python[1]$ python2.6
iPython 2.6a1+ (trunk:62045M, Mar 30 2008, 03:07:23) 
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import test.test_urllib2
>>> print test.test_urllib2.test_request_headers_dict.__doc__
 The Request.headers dictionary is not a documented interface. It should
 stay that way, because the complete set of headers are only accessible
 through the .get_header(), .has_header(), .header_items() interface.
 However, .headers pre-dates those methods, and so real code will be
using
 the dictionary.
 The introduction in 2.4 of those methods was a mistake for the same
reason:
 code that previously saw all (urllib2 user)-provided headers in .headers
 now sees only a subset (and the function interface is ugly and
incomplete).
 A better change would have been to replace .headers dict with a dict
 subclass (or UserDict.DictMixin instance?) that preserved the .headers
 interface and also provided access to the "unredirected" headers. It's
 probably too late to fix that, though.
 Check .capitalize() case normalization:
 >>> url = "http://example.com"
 >>> Request(url, headers={"Spam-eggs": "blah"}).headers["Spam-eggs"]
 'blah'
 >>> Request(url, headers={"spam-EggS": "blah"}).headers["Spam-eggs"]
 'blah'
 Currently, Request(url, "Spam-eggs").headers["Spam-Eggs"] raises
KeyError,
 but that could be changed in future.
 
>>>
History
Date User Action Args
2008年03月30日 14:56:52jjleesetspambayes_score: 0.0322416 -> 0.03224158
recipients: + jjlee, orsenthil, frispete
2008年03月30日 14:56:51jjleesetspambayes_score: 0.0322416 -> 0.0322416
messageid: <1206889011.71.0.0201052837496.issue2275@psf.upfronthosting.co.za>
2008年03月30日 14:56:50jjleelinkissue2275 messages
2008年03月30日 14:56:49jjleecreate

AltStyle によって変換されたページ (->オリジナル) /