How do I make urllib2 preserve case in HTTP header names?

John J. Lee jjl at pobox.com
Thu Oct 11 20:31:17 CEST 2007


tepples at spamcop.net writes:

> The HTTP specification, RFC 2616, states that field names in HTTP
> headers are case insensitive.  But I'm trying to use Python 2.5.1's
> urllib2 to interact with a web service offered by Amazon.com, which
> deviates from the HTTP spec in that it requires use of case-sensitive
> header names ReportName, ReportID, and NumberOfReports.  I try to send
> an HTTP header named "NumberOfReports", but it comes out mangled as
> "Numberofreports'.  What is the best way to use Python 2.5.1 on
> Windows Server 2003 to create HTTP or HTTPS requests that do not
> mangle the case of header field names?

httplib


John



More information about the Python-list mailing list