Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第一章例子无结果 #5

Open
Jasonwu123 opened this issue Oct 28, 2019 · 0 comments
Open

第一章例子无结果 #5

Jasonwu123 opened this issue Oct 28, 2019 · 0 comments

Comments

@Jasonwu123
Copy link

看了第一章,在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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant