警告提示为:
DeprecationWarning: please use dns.resolver.Resolver.resolve()
警告源代码类似下面:
# my_resolver = dns.resolver.Resolver()
my_resolver = dns.resolver.Resolver.resolve()
answers = my_resolver.query(host, "A")
answer_txt = my_resolver.query(host, "TXT")
You should remove .resolve from my_resolver = dns.resolver.Resolver.resolve() and replace my_resolver.query() with my_resolver.resolve()
然后在源代码中把query
改成resolver
my_resolver = dns.resolver.Resolver()
answers = my_resolver.resolve(host, "A")
answer_txt = my_resolver.resolve(host, "TXT")