看suds的源码后,没有发现timeout,但是发现了set_options函数,具体代码如下:
class Client(UnicodeMixin):
# ....
def __init__(self, url, **kwargs):
"""
@param url: The URL for the WSDL.
@type url: str
@param kwargs: keyword arguments.
@see: L{Options}
"""
options = Options()
options.transport = suds.transport.https.HttpAuthenticated()
self.options = options
if "cache" not in kwargs:
kwargs["cache"] = suds.cache.ObjectCache(days=1)
self.set_options(**kwargs)
reader = DefinitionsReader(options, Definitions)
self.wsdl = reader.open(url)
plugins = PluginContainer(options.plugins)
plugins.init.initialized(wsdl=self.wsdl)
self.factory = Factory(self.wsdl)
self.service = ServiceSelector(self, self.wsdl.services)
self.sd = []
for s in self.wsdl.services:
sd = ServiceDefinition(self.wsdl, s)
self.sd.append(sd)
def set_options(self, **kwargs):
"""
Set options.
@param kwargs: keyword arguments.
@see: L{Options}
"""
p = Unskin(self.options)
p.update(kwargs)
#下面这个debug是我加的
log.debug("set_options = %s", p)
先创建client对象,执行下面的操作:
>>> client.set_options(timeout=120)
DEBUG:suds.client:set_options = Definitions:
prettyxml: classes=(<type 'bool'>,), default=False
cachingpolicy: classes=(<type 'int'>,), default=0
soapheaders: classes=*, default=()
documentStore: classes=(<class 'suds.store.DocumentStore'>,), default=<suds.store.DocumentStore object at 0x7f3378bc7fd0>
extraArgumentErrors: classes=(<type 'bool'>,), default=True
service: classes=(<type 'int'>, <type 'basestring'>), default=None
doctor: classes=(<class suds.xsd.doctor.Doctor at 0x7f3378bcd258>,), default=None
cache: classes=(<class 'suds.cache.Cache'>,), default=<suds.cache.NoCache object at 0x7f3377e23450>
retxml: classes=(<type 'bool'>,), default=False
prefixes: classes=(<type 'bool'>,), default=True
faults: classes=(<type 'bool'>,), default=True
wsse: classes=(<class 'suds.wsse.Security'>,), default=None
autoblend: classes=(<type 'bool'>,), default=False
location: classes=(<type 'basestring'>,), default=None
plugins: classes=(<type 'list'>, <type 'tuple'>), default=[]
unwrap: classes=(<type 'bool'>,), default=True
xstq: classes=(<type 'bool'>,), default=True
port: classes=(<type 'int'>, <type 'basestring'>), default=None
transport: classes=(<class 'suds.transport.Transport'>,), default=None
nosend: classes=(<type 'bool'>,), default=False
Content:
('cachingpolicy', 0)
('soapheaders', ())
('cache', <suds.cache.ObjectCache object at 0x7f3377bbc7d0>)
('extraArgumentErrors', True)
('service', None)
('doctor', None)
('documentStore', <suds.store.DocumentStore object at 0x7f3378bc7fd0>)
('port', None)
('prefixes', True)
('faults', True)
('wsse', None)
('autoblend', False)
('location', None)
('nosend', False)
('plugins', [])
('unwrap', True)
('prettyxml', False)
('retxml', False)
('transport', <suds.transport.https.HttpAuthenticated object at 0x7f3377bbc490>)
('xstq', True)
Linked:
Definitions:
username: classes=(<type 'basestring'>,), default=None
headers: classes=(<type 'dict'>,), default={}
password: classes=(<type 'basestring'>,), default=None
proxy: classes=(<type 'dict'>,), default={}
timeout: classes=(<type 'int'>, <type 'float'>), default=90
Content:
('username', 'admin')
('headers', {})
('password', 'admin_default')
('proxy', {})
('timeout', 120)
Linked:
Definitions:
prettyxml: classes=(<type 'bool'>,), default=False
cachingpolicy: classes=(<type 'int'>,), default=0
soapheaders: classes=*, default=()
documentStore: classes=(<class 'suds.store.DocumentStore'>,), default=<suds.store.DocumentStore object at 0x7f3378bc7fd0>
extraArgumentErrors: classes=(<type 'bool'>,), default=True
service: classes=(<type 'int'>, <type 'basestring'>), default=None
doctor: classes=(<class suds.xsd.doctor.Doctor at 0x7f3378bcd258>,), default=None
cache: classes=(<class 'suds.cache.Cache'>,), default=<suds.cache.NoCache object at 0x7f3377e23450>
retxml: classes=(<type 'bool'>,), default=False
prefixes: classes=(<type 'bool'>,), default=True
faults: classes=(<type 'bool'>,), default=True
wsse: classes=(<class 'suds.wsse.Security'>,), default=None
autoblend: classes=(<type 'bool'>,), default=False
location: classes=(<type 'basestring'>,), default=None
plugins: classes=(<type 'list'>, <type 'tuple'>), default=[]
unwrap: classes=(<type 'bool'>,), default=True
xstq: classes=(<type 'bool'>,), default=True
port: classes=(<type 'int'>, <type 'basestring'>), default=None
transport: classes=(<class 'suds.transport.Transport'>,), default=None
nosend: classes=(<type 'bool'>,), default=False
Content:
('cachingpolicy', 0)
('soapheaders', ())
('cache', <suds.cache.ObjectCache object at 0x7f3377bbc7d0>)
('extraArgumentErrors', True)
('service', None)
('doctor', None)
('documentStore', <suds.store.DocumentStore object at 0x7f3378bc7fd0>)
('port', None)
('prefixes', True)
('faults', True)
('wsse', None)
('autoblend', False)
('location', None)
('nosend', False)
('plugins', [])
('unwrap', True)
('prettyxml', False)
('retxml', False)
('transport', <suds.transport.https.HttpAuthenticated object at 0x7f3377bbc490>)
('xstq', True)
timeout默认为90秒。