I have my own domain where an json file is stored (http://example.com/file.json)
. When accesing the file in browser using the direct link, the json is returned just fine. But when using the same approach in my python code below, the http response is 406. Any ideas why?
import requests
url = 'http://example.com/file.json'
r = requests.get(url, headers={"Accept":"text/html"})
print(r.status_code)
print(r.headers)
Prints:
406
{'Server': 'nginx/1.14.1', 'Date': 'Sun, 12 May 2019 16:53:25 GMT', 'Content-Type': 'text/html; charset=iso-8859-1', 'Content-Length': '226', 'Connection': 'k
eep-alive'}