當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。