本文整理汇总了Python中suds.client.Client.connect方法的典型用法代码示例。如果您正苦于以下问题:Python Client.connect方法的具体用法?Python Client.connect怎么用?Python Client.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类suds.client.Client
的用法示例。
在下文中一共展示了Client.connect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SudsClient
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import connect [as 别名]
class SudsClient(object):
zope.interface.implements(ClientAdapter)
def __init__(self, wsdl, options={}):
if 'headers' not in options:
options['headers'] = {}
if 'plugins' not in options:
options['plugins'] = []
options['headers'].update({'Accept-Encoding': 'gzip'})
options['plugins'].append(SupportGZIPPlugin())
self.client = Client(wsdl, **options)
self.client.connect()
def set_headers(self, headers):
self.client.set_options(soapheaders=headers)
def send_request(self, method_name, params):
return getattr(self.client.service, method_name)(**params)
def get_last_response(self):
return self.client.last_received()
def get_last_request(self):
return self.client.last_sent()
def new_context(self):
return SudsClientProxy(self)
示例2: SudsClient
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import connect [as 别名]
class SudsClient(object):
zope.interface.implements(ClientAdapter)
def __init__(self, wsdl, options={}):
if not 'plugins' in options:
options['plugins'] = [SoapEnvelopeNamespaceFix()]
else:
options['plugins'].append(SoapEnvelopeNamespaceFix())
# TODO: add headers for compression per provider/request
if not 'headers' in options:
options['headers'] = {}
options['headers'].update({"Accept-Encoding": "gzip"})
options['plugins'] = [SupportGZIPPlugin()]
self.client = Client(wsdl, **options)
self.client.connect()
def set_headers(self, headers):
self.client.set_options(soapheaders=headers)
def send_request(self, method_name, params):
return getattr(self.client.service, method_name)(**params)
def get_last_response(self):
return self.client.last_received()
def get_last_request(self):
return self.client.last_sent()
def new_context(self):
return SudsClientProxy(self)
示例3: SoapClient
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import connect [as 别名]
class SoapClient(object):
def __init__(self, wsdl):
self.client = Client(wsdl, plugins=[SoapEnvelopeNamespaceFix()])
self.client.connect()
self.client.set_options(nosend=True)
def setHeaders(self, headers):
self.client.set_options(soapheaders=headers)
"""
Fake send function.
@return: deferred
"""
def body(self, methodName, params):
return getattr(self.client.service, methodName)(**params)
示例4: main
# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import connect [as 别名]
def main():
try:
url = 'https://sec.neurofuzz-software.com/paos/genSSHA-SOAP.php?wsdl'
print 'Test @ ( %s )' % (url)
client = Client(url)
yield client.connect()
print client
res = yield client.service.genSSHA('hello', 'sha1')
print res
except WebFault, f:
print f
print f.fault