| Server IP : 107.13.46.68 / Your IP : 216.73.216.232 Web Server : Apache/2.4.58 (Ubuntu) System : Linux mariOS 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/python3-dnspython/examples/ |
Upload File : |
#!/usr/bin/env python3
#
# This is an example of sending DNS queries over HTTPS (DoH) with dnspython.
import httpx
import dns.message
import dns.query
import dns.rdatatype
def main():
where = "https://dns.google/dns-query"
qname = "example.com."
with httpx.Client() as client:
q = dns.message.make_query(qname, dns.rdatatype.A)
r = dns.query.https(q, where, session=client)
for answer in r.answer:
print(answer)
# ... do more lookups
if __name__ == "__main__":
main()