Link github repository: https://github.com/mansuf/requests-doh
It's awful to use DNS resolver from your ISP. Sometimes it's working, sometimes it don't. This is why public DNS resolvers is created to help you get rid of this (also to protect your privacy too 😉).
requests-doh are using dnspython library to query DoH to public DNS servers.
requests-doh can be installed from PyPI (Python Package Index)
# For Windows py -3 -m pip install requests-doh # For Unix-based systems python3 -m pip install requests-doh
requests-doh is simple as importing
requests-doh module, create DoH requests session, and then you're done !
from requests_doh import DNSOverHTTPSSession # By default, DoH provider will be set to `cloudflare` # You can change this to any provider # See https://requests-doh.mansuf.link/en/stable/doh_providers.html # for available DoH providers session = DNSOverHTTPSSession(provider='cloudflare') r = session.get('https://example.com') print(r.content)