I'm trying to make a python script to test if a server can answer in DNS-over-HTTPS. So, I read this article and try to make the same request but in python :
import requests
r=requests.get("https://cloudflare-dns.com/dns-query?name=example.com&type=A", headers={"accept":"application/dns-message"})
print(r.url)
print(r.headers)
print(r.status_code)
Here is the output
https://cloudflare-dns.com/dns-query?name=example.com&type=A
{'Access-Control-Allow-Origin': '*', 'Vary': 'Accept-Encoding', 'CF-RAY': '48b33f92aec83e4a-ZRH', 'Expect-CT': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"', 'Date': 'Tue, 18 Dec 2018 17:11:23 GMT', 'Transfer-Encoding': 'chunked', 'Server': 'cloudflare', 'Connection': 'keep-alive'} 400
If I base me on what's written here, my request is not specified or too small.
Does anyone sees where I'm mistaking?
Thanks