suds 轻量化访问webservice

from suds.client import Client


def func():
    someVar = 'test'
    try:
        url ='http://IP:Port/services/Abcservice?wsdl'
        client = Client(url)
        return client.service.method(someVat)
    except Exception,x:
        raise x

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


但当服务经过多级网络互转之后
,发现会出现time_wait


可以通过修改下
client = Client(url,cache=None)
取消缓存 ,每次方法访问都用地址在去获取一遍
并将 url添加到
client.set_options(location=url)

 
 
posted @ 2022-07-21 15:20  东海之洋  阅读(86)  评论(0)    收藏  举报