I'm trying to get a url using python requests. requests.get('https://google.com') works fine but then I add my custom headers and get a redirect loop, why?
import requests
s = requests.Session()
s.headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en",
"Host": "google.com",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
"X-Amzn-Trace-Id": "Root=1-63261f60-6a62c4934cad2e126b4bdd8c"
}
s.get('https://google.com')
I then get this error:
raise TooManyRedirects(
requests.exceptions.TooManyRedirects: Exceeded 30 redirects.