📜  如何使用 python 代码示例查询 DNS 记录

📅  最后修改于: 2022-03-11 14:45:18.684000             🧑  作者: Mango

代码示例2
import dns.resolver
name = 'iana.org'
for qtype in 'A', 'AAAA', 'MX', 'NS', 'TXT', 'SOA':
    answer = dns.resolver.query(name,qtype, raise_on_no_answer=False)
    if answer.rrset is not None:
        print(answer.rrset)