Create script to detect if DoH is enable

I’m currently trying to create a script in python to detect whether the server support DoH or not
Here is my code (based on the informations here)

#!/usr/bin/env python3
import requests
r=requests.get(“”, headers={“accept”:“application/dns-message”})

But the answer that I get is 400.
Can anyone help me?

What do you mean by that? Which server?

If I try to make a DoH request to a server and the answer is good, I can conclude that he supports DoH.
I know that the server in my script(the one from Cloudflare) accepts DoH, but I’m trying with this one to be sure my script is working properly

What server are you talking about? Are you trying to check whether a certain HTTPS URL is an actual DoH endpoint/server?

If a take a list of 100 IP DNS server for example, to check if they can answer in DoH

You basically need to implement a DoH client, but that topic is way off-topic for here.

Yeah, but I’m trying to make a script for it, so I don’t have to copy /paste each IP one by one

In any case it is off-topic for the forum here :wink:

This topic was automatically closed after 30 days. New replies are no longer allowed.