如何使用dns.resolver捕获“不存在DNS查询名称”

时间:2019-02-13 09:28:54

标签: python dnspython

我正在使用dns.resolver.query(domain,'MX')检查MX记录的电子邮件ID,当我检查一个不存在的域时,出现错误

<code>
Traceback (most recent call last):
  File "mxrecord.py", line 27, in <module>
    records = dns.resolver.query(domain, 'MX')
  File "C:\Python27\lib\site-packages\dns\resolver.py", line 1102, in query
    lifetime)
  File "C:\Python27\lib\site-packages\dns\resolver.py", line 1002, in query
    raise NXDOMAIN(qnames=qnames_to_try, responses=nxdomain_responses)
dns.resolver.NXDOMAIN: None of DNS query names exist: krenovate1.com., krenovate1.com
</code>

我想用它来更新CSV文件中的状态。我该怎么办?

0 个答案:

没有答案