Python Requests Client Error: Bad Request, But Works After Website Has Been Opened In Browser
I'm having a weird problem where I get a 400 Client Error: Bad Request on a url that I have never opened, but then if I open that same url with my browser and then close it, I am a
Solution 1:
Pass a user-agent and it will work :
u_a = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36"
response = requests.get(url, headers={"USER-AGENT":u_a})
Post a Comment for "Python Requests Client Error: Bad Request, But Works After Website Has Been Opened In Browser"