2016-06-13 6 views
2

私は泡のライブラリを使用して次のスクリプトを実行しようとしています:IPにDNS名がないと、このPythonエラーメッセージが表示されますか?

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> 

このエラーの原因は何ですか?

EDIT: はまた、このスクリプトは、私は物事が私のhostsファイルに、サーバーのIPを追加し、その後にハードコードされたホスト名に関連付けることで正常に動作させることができましたWindows 7の環境

+0

他の方法でhttp://10.14.9.42にアクセスできますか? – Mirac7

+0

@ Mirac7実際に私は手動でホスト名(私たちのDNSサーバーではなくサーバー自体で設定されている)を使用してサーバーを自分のPCのホストファイルに手動で追加しました。 – lacrosse1991

答えて

関連する問題