IP 不存在的 dns 名称会导致此 python 错误消息吗?
Would a dns name not existing for an IP cause this python error message?
我正在尝试使用 suds 库运行以下脚本:
from suds.client import Client
from suds.transport.http import HttpAuthenticated
import os
t = HttpAuthenticated(username='xxxxxxx', password='xxxxxxxx')
url = 'http://10.14.9.42/NodeBeanService/NodeBean?wsdl'
client = Client(url, transport=t)
filterlimit = client.factory.create('ns3:constraint')
filterlimit.name = "maxObjects"
filterlimit.value = "30000"
filter1 = client.factory.create('ns3:condition')
filter1.name = "status"
filter1.operator = "EQ"
filter1.value = "NORMAL"
filter2 = client.factory.create('ns3:condition')
filter2.name = "notes"
filter2.operator = "NE"
filter2.value = "none"
filter = client.factory.create('ns3:expression')
filter.operator = "AND"
filter.subFilters = [filter1, filter2, filterlimit]
allNodes = client.service.getNodes(filter)
print "Nodes in topology:", len(allNodes.item)
for i in allNodes.item[:]:
print i.name,i.notes,i.id
此脚本在一台服务器上工作得很好,但是当我尝试另一台没有分配 dns 名称的服务器时,我不断收到以下错误:
C:\Users\pzsr7z.000\Documents>python testnnm.py
Traceback (most recent call last):
File "testnnm.py", line 27, in <module>
allNodes = client.service.getNodes(filter)
File "C:\Python27\lib\site-packages\suds\client.py", line 521, in __call__
return client.invoke(args, kwargs)
File "C:\Python27\lib\site-packages\suds\client.py", line 581, in invoke
result = self.send(soapenv)
File "C:\Python27\lib\site-packages\suds\client.py", line 613, in send
reply = self.options.transport.send(request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 239, in send
return HttpTransport.send(self, request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 82, in send
fp = self.u2open(u2request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 132, in u2open
return url.open(u2request, timeout=tm)
File "C:\Python27\lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 449, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python27\lib\urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 11004] getaddrinfo failed>
什么可能导致此错误?
编辑:
此外,此脚本 运行 来自 windows 7 环境
通过将服务器的 IP 添加到我的主机文件,然后将其与服务器上硬编码的主机名相关联,我能够让一切正常工作
我正在尝试使用 suds 库运行以下脚本:
from suds.client import Client
from suds.transport.http import HttpAuthenticated
import os
t = HttpAuthenticated(username='xxxxxxx', password='xxxxxxxx')
url = 'http://10.14.9.42/NodeBeanService/NodeBean?wsdl'
client = Client(url, transport=t)
filterlimit = client.factory.create('ns3:constraint')
filterlimit.name = "maxObjects"
filterlimit.value = "30000"
filter1 = client.factory.create('ns3:condition')
filter1.name = "status"
filter1.operator = "EQ"
filter1.value = "NORMAL"
filter2 = client.factory.create('ns3:condition')
filter2.name = "notes"
filter2.operator = "NE"
filter2.value = "none"
filter = client.factory.create('ns3:expression')
filter.operator = "AND"
filter.subFilters = [filter1, filter2, filterlimit]
allNodes = client.service.getNodes(filter)
print "Nodes in topology:", len(allNodes.item)
for i in allNodes.item[:]:
print i.name,i.notes,i.id
此脚本在一台服务器上工作得很好,但是当我尝试另一台没有分配 dns 名称的服务器时,我不断收到以下错误:
C:\Users\pzsr7z.000\Documents>python testnnm.py
Traceback (most recent call last):
File "testnnm.py", line 27, in <module>
allNodes = client.service.getNodes(filter)
File "C:\Python27\lib\site-packages\suds\client.py", line 521, in __call__
return client.invoke(args, kwargs)
File "C:\Python27\lib\site-packages\suds\client.py", line 581, in invoke
result = self.send(soapenv)
File "C:\Python27\lib\site-packages\suds\client.py", line 613, in send
reply = self.options.transport.send(request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 239, in send
return HttpTransport.send(self, request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 82, in send
fp = self.u2open(u2request)
File "C:\Python27\lib\site-packages\suds\transport\http.py", line 132, in u2open
return url.open(u2request, timeout=tm)
File "C:\Python27\lib\urllib2.py", line 431, in open
response = self._open(req, data)
File "C:\Python27\lib\urllib2.py", line 449, in _open
'_open', req)
File "C:\Python27\lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "C:\Python27\lib\urllib2.py", line 1227, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "C:\Python27\lib\urllib2.py", line 1197, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error [Errno 11004] getaddrinfo failed>
什么可能导致此错误?
编辑: 此外,此脚本 运行 来自 windows 7 环境
通过将服务器的 IP 添加到我的主机文件,然后将其与服务器上硬编码的主机名相关联,我能够让一切正常工作