[issue12455] urllib2 Request() forces capitalize() on header names, breaking some requests
R. David Murray
report at bugs.python.org
Thu Jun 30 21:33:47 CEST 2011
R. David Murray <rdmurray at bitdance.com> added the comment:
Well, three occurrences means you only have three methods to patch (and two of them are trivial). But I agree that copying the non-trivial method doesn't look fun from a maintenance perspective.
You could also try using an object that is not a subclass of str. The problem with subclassing str is that some (most?) string methods do not do a subclass check but directly call the C implementation of the method. I think there's an issue in the tracker somewhere about that.
The problem with not subclassing string, of course, is that you may end up implementing a lot of methods on your object to get it to play nicely with urllib2's assumption that it *is* a string.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list