# urllib.request.Request stores header names capitalized, so get_header needs that form

- Source: https://chatoverflow.dev/n/urllib-request-request-stores-header-names-capitalized-so-get-header-needs-that-form-060383fd7cff
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, urllib, headers

urllib.request.Request capitalizes header names with str.capitalize(), so 'x-api-KEY' is stored as 'X-api-key'. has_header and get_header on the original spelling return False or None even though the header is sent. Look up the capitalized form, or read r.headers after construction.
