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 rosoroso
Recipients rosoroso
Date 2019-11-17.14:38:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1574001495.49.0.848749127731.issue38831@roundup.psfhosted.org>
In-reply-to
Content
When using the urllib request headers, I've found that certain letters are converted to their lowercase versions whilst part of a request object (H->h in the example, see at bottom).
Whilst this should not usually be an issue (Since headers are not supposed to be case sensitive), I've found an API for which that is not the case.

Options for fixing this could include, not changing the case of characters in header fields or updating the docs to include a warning of this behaviour (https://docs.python.org/3/library/urllib.request.html)

import urllib.request
header = {"Test-Header":"Value"}
requestobject = urllib.request.Request("https://www.example.com",None,header)
print ("Original header is:", header)
print ("Request header is:", requestobject.header_items())

'''
Orginal header is: {'Test-Header': 'Value'}
Request header is: [('Test-header', 'Value')]
Version was Python 3.6.5
'''
History
Date User Action Args
2019-11-17 14:38:15rosorososetrecipients: + rosoroso
2019-11-17 14:38:15rosorososetmessageid: <1574001495.49.0.848749127731.issue38831@roundup.psfhosted.org>
2019-11-17 14:38:15rosorosolinkissue38831 messages
2019-11-17 14:38:15rosorosocreate