| Server IP : 172.67.134.116 / Your IP : 216.73.217.22 Web Server : Apache System : Linux server.rehabsharif.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : nobi37te ( 1003) PHP Version : 8.2.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/thread-self/root/usr/share/doc/python3-dns/examples/ |
Upload File : |
import sys
import trio
import dns.message
import dns.asyncquery
import dns.asyncresolver
async def main():
if len(sys.argv) > 1:
host = sys.argv[0]
else:
host = "www.dnspython.org"
q = dns.message.make_query(host, "A")
r = await dns.asyncquery.udp(q, "8.8.8.8")
print(r)
q = dns.message.make_query(host, "A")
r = await dns.asyncquery.tcp(q, "8.8.8.8")
print(r)
q = dns.message.make_query(host, "A")
r = await dns.asyncquery.tls(q, "8.8.8.8")
print(r)
a = await dns.asyncresolver.resolve(host, "A")
print(a.response)
zn = await dns.asyncresolver.zone_for_name(host)
print(zn)
answer = await dns.asyncresolver.resolve_at("8.8.8.8", "amazon.com", "NS")
print("The amazon.com nameservers are:")
for rr in answer:
print(rr.target)
if __name__ == "__main__":
trio.run(main)