DNS查找python socket.getHostbyName vs nslookup

时间:2017-09-28 12:53:01

标签: python dns nslookup

我无法在脚本中解析dns查找。但是在shell中使用nslookup命令可以解析相同的条目。有谁知道它为什么会那样?

我得到的错误如下:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/replay_engine_app/replay_engine/replay_engine.py", line 42, in connectDevice
    client_handle = socket.gethostbyname(dns_address)
socket.gaierror: [Errno -2] Name or service not known

从代码打印dns_address:

  

设备模拟器0.device.default.svc.cluster.local

nslookup命令的屏幕截图:

Screenshot of the nslookup command

0 个答案:

没有答案