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

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

tepples at 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, 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?



More information about the Python-list mailing list