| Server IP : 157.22.201.140 / Your IP : 216.73.216.74 Web Server : nginx/1.30.1 System : Linux mit.vincode.fvds.ru 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/doc/python3-dnspython/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)