V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
lxk11153
V2EX  ›  问与答

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

  •  
  •   lxk11153 · May 9, 2020 · 1318 views
    This topic created in 2188 days ago, the information mentioned may be changed or developed.
    • 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 replies    2020-05-13 10:11:25 +08:00
    lxk11153
        1
    lxk11153  
    OP
       May 13, 2020
    @peizhao2017 你也有这个 "DNSError: (12" 问题吗?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1040 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 18:42 · PVG 02:42 · LAX 11:42 · JFK 14:42
    ♥ Do have faith in what you're doing.