0

I want to send the same header parameter twice with python requests. is it possible?

When I try to do the following request, the Requests lib from python ignores one of the passed headers even sending it with different cases:

Example:

import requests

url = "http://www.example.com"

headers = {"test":"test1", 
           "Test":"test2"}

req = requests.get(url, headers=headers)

print(req.request.headers)

1 Answers1

0

HTTP header names are not case-sensitive, so requests handles this correctly. That the keys in the dictionary are case-insensitive is also sometimes mentioned in requests' docs, like Session.headers, Response.headers

ForceBru
  • 43,482
  • 10
  • 63
  • 98