V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lxk11153
V2EX  ›  问与答

aiodns.error.DNSError: (12, 'Timeout while contacting DNS servers')

  •  
  •   lxk11153 · 2020-05-09 13:36:11 +08:00 · 1128 次点击
    这是一个创建于 1953 天前的主题,其中的信息可能已经有所发展或是发生改变。
    • nslookup
    # nslookup baidu.com
    非权威应答:
    服务器:  UnKnown
    Address:  192.168.1.1
    
    名称:    baidu.com
    Addresses:  220.181.38.148
    	  39.156.69.79
    
    • python (Cygwin, Windows Server 2016)
    import asyncio
    import aiodns
    loop = asyncio.get_event_loop()
    resolver = aiodns.DNSResolver(loop=loop)
    async def query(name, query_type):
        return await resolver.query(name, query_type)
    coro = query('baidu.com', 'A')
    result = loop.run_until_complete(coro)
    print(result)
    
    # python3.7 resolvertest.py
    Traceback (most recent call last):
      File "resolvertest.py", line 8, in <module>
        result = loop.run_until_complete(coro)
      File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
        return future.result()
      File "resolvertest.py", line 6, in query
        return await resolver.query(name, query_type)
    aiodns.error.DNSError: (12, 'Timeout while contacting DNS servers')
    
    1 条回复    2020-05-13 10:11:25 +08:00
    lxk11153
        1
    lxk11153  
    OP
       2020-05-13 10:11:25 +08:00
    @peizhao2017 你也有这个 "DNSError: (12" 问题吗?
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2434 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:46 · PVG 23:46 · LAX 08:46 · JFK 11:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.