Created
April 19, 2018 07:02
-
-
Save bwangelme/ccf7f35d6e513bbff94e281633fcc3b6 to your computer and use it in GitHub Desktop.
Python DNS 查询时指定DNS服务器
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*-" | |
| import dns.resolver | |
| myResolver = dns.resolver.Resolver() | |
| myResolver.nameservers = ['223.5.5.5', '223.6.6.6'] | |
| myAnswers = myResolver.query("www.baidu.com", "A") | |
| for rdata in myAnswers: | |
| print(rdata) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pip install dnspython