当前位置: 首页>>代码示例>>Python>>正文


Python Client.connect方法代码示例

本文整理汇总了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)
开发者ID:tripsta,项目名称:mamba,代码行数:34,代码来源:suds_client.py

示例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)
开发者ID:pgk,项目名称:mamba,代码行数:35,代码来源:suds_client.py

示例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)
开发者ID:pgk,项目名称:mamba,代码行数:18,代码来源:client.py

示例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
开发者ID:abierbaum,项目名称:twisted-suds,代码行数:14,代码来源:test_twisted.py


注:本文中的suds.client.Client.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。