gpt4 book ai didi

python - 网址错误 : Python

转载 作者:行者123 更新时间:2023-11-28 21:55:27 38 4
gpt4 key购买 nike

我有一个简单的 suds 网络服务客户端,一段时间以来一直运行良好。但是,我现在每次运行它时都会收到“urllib2.URLError:”。请注意,我可以成功 ping 远程主机,也可以在远程主机端口上远程登录。我可以检查哪些内容来解决此问题?下面是我的代码片段:

from suds.client import Client
from suds.wsse import *
security = Security()
token = UsernameToken('user', 'pass')
token.setnonce()
token.setcreated()
security.tokens.append(token)

def func():
someVar = '2222222'
try:
url ='http://IP:Port/SomeWebServices/service?wsdl'
client = Client(url)
return client.service.SomeMeth(someVat)
except Exception,x:
raise x

if __name__ == '__main__':
response = func()
print response['responseCode']
print response['balance']

最佳答案

也许你可以试试:

    url ="your?wsdl"

client = Client(url,cache=None)

client.set_options(location=url) // new line

return client.service.SomeMeth(someVat)

关于python - 网址错误 : <urlopen error [Errno 111] Connection refused> Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22719257/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com