pyauto
pyauto copied to clipboard
第一章例子无结果
看了第一章,在centos7 python2.7.5上做,照着书上的代码敲,除了A记录那个脚本能有结果,其他都报错了:
#!/usr/bin/env python
# coding=utf-8
import dns.resolver
domain = raw_input("Please input an domain: ")
MX = dns.resolver.query(domain,'MX')
for i in MX:
print("MX preference = ",i.preference,"mail exchange = ",i.exchange)
报错如下:
Traceback (most recent call last):
File "dnsMX.py", line 5, in <module>
MX = dns.resolver.query(domain,'MX')
File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 1102, in query
lifetime)
File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 992, in query
timeout = self._compute_timeout(start, lifetime)
File "/usr/lib/python2.7/site-packages/dns/resolver.py", line 799, in _compute_timeout
raise Timeout(timeout=duration)
dns.exception.Timeout: The DNS operation timed out after 30.0029888153 seconds