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


Python Client.__str__方法代码示例

本文整理汇总了Python中suds.client.Client.__str__方法的典型用法代码示例。如果您正苦于以下问题:Python Client.__str__方法的具体用法?Python Client.__str__怎么用?Python Client.__str__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在suds.client.Client的用法示例。


在下文中一共展示了Client.__str__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ClientWrapper

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import __str__ [as 别名]
class ClientWrapper(object):
    """
    A custom wrapper of suds web service client for the monopond fax web services.
    Extends mapping utils to handle mapping of api objects to client objects.
    @ivar _client: suds client.
    @type _client:L{Client}
    """
    def __init__(self, url, username, password):
        self._client = Client(url)
        wsse_ns = ("wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd")
        mustAttribute = Attribute('SOAP-ENV:mustUnderstand', '1')
        security_header = Element("Security", ns=wsse_ns).append(mustAttribute)

        message_header = Element("UsernameToken", ns=wsse_ns)
        message_header.insert(Element("Username", ns=wsse_ns).setText(username))
        message_header.insert(Element("Password", ns=wsse_ns).setText(password))
        security_header.insert(message_header)
        self._client.set_options(soapheaders = security_header)

        self.mappingUtils = MappingUtils(self._client)

    def sendFax(self, request):
        if isinstance(request, SendFaxRequest) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        apiFaxDocuments = self.mappingUtils.mapDocumentListToApiFaxDocumentList(request.documents)
        apiFaxMessages = self.mappingUtils.mapFaxMessageListToApiFaxMessageList(request.faxMessages)
        apiFaxMessageBlocklist = None
        #if request.blocklists is not None:
            #apiFaxMessageBlocklist = self.mappingUtils.mapBlocklistsToApiFaxMessageBlocklist(request.blocklists)
        result = self._client.service.SendFax(BroadcastRef=request.broadcastRef, SendRef=request.sendRef,
            FaxMessages= apiFaxMessages, Documents=apiFaxDocuments, Resolution=request.resolution,
            Blocklists = apiFaxMessageBlocklist, Retries=request.retries, HeaderFormat=request.headerFormat)
        wrappedResult = self.mappingUtils.mapApiResponseToResponse(result)
        return wrappedResult

    def faxStatus(self, request):
        if isinstance(request, FaxStatusRequest) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        result = self._client.service.FaxStatus(MessageRef=request.messageRef, SendRef=request.sendRef,
            BroadcastRef=request.broadcastRef, Verbosity=request.verbosity)
        wrappedResult = self.mappingUtils.mapApiResponseToResponse(result)
        return wrappedResult

    def pauseFax(self, request):
        if isinstance(request, PauseFaxRequest) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        result = self._client.service.PauseFax(MessageRef=request.messageRef, SendRef=request.sendRef,
            BroadcastRef=request.broadcastRef)
        wrappedResult = self.mappingUtils.mapApiResponseToResponse(result)
        return wrappedResult

    def resumeFax(self, request):
        if isinstance(request, ResumeFaxRequest) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        result = self._client.service.ResumeFax(MessageRef=request.messageRef, SendRef=request.sendRef,
            BroadcastRef=request.broadcastRef)
        wrappedResult = self.mappingUtils.mapApiResponseToResponse(result)
        return wrappedResult

    def stopFax(self, request):
        if isinstance(request, StopFaxRequest) is False:
            raise TypeError, "%s incorrect request type" % (request.__class__)
        result = self._client.service.StopFax(MessageRef=request.messageRef, SendRef=request.sendRef,
            BroadcastRef=request.broadcastRef)
        wrappedResult = self.mappingUtils.mapApiResponseToResponse(result)
        print result
        return wrappedResult

    def getTypeInstance(self, typeName):
        return self._client.factory.create(typeName)

    def __str__(self):
        return self._client.__str__()
开发者ID:Monopond,项目名称:fax-api-client-python,代码行数:75,代码来源:monopond_python_client.py

示例2: BaseZuora

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import __str__ [as 别名]

#.........这里部分代码省略.........
        Amend susbcriptions.
        """
        response = self.call(
            self.client.service.amend,
            amend_requests)
        return response

    def create(self, z_objects):
        """
        Create z_objects.
        """
        response = self.call(
            self.client.service.create,
            z_objects)
        return response

    def delete(self, object_string, ids=[]):
        """
        Delete z_objects by ID.
        """
        response = self.call(
            self.client.service.delete,
            object_string, ids)
        return response

    def execute(self, object_string, synchronous=False, ids=[]):
        """
        Execute a process by IDs.
        """
        response = self.call(
            self.client.service.execute,
            object_string, synchronous, ids)
        return response

    def generate(self, z_objects):
        """
        Generate z_objects.
        """
        response = self.call(
            self.client.service.execute,
            z_objects)
        return response

    def get_user_info(self):
        """
        Return current user's info.
        """
        response = self.call(
            self.client.service.get_user_info)
        return response

    def login(self):
        """
        Login on the API to get a session.
        """
        response = self.client.service.login(self.username, self.password)
        self.set_session(response.Session)
        return response

    def query(self, query_string):
        """
        Execute a query.
        """
        response = self.call(
            self.client.service.query,
            query_string)
        return response

    def query_more(self, query_locator):
        """
        Execute the suite of a query.
        """
        response = self.call(
            self.client.service.queryMore,
            query_locator)
        return response

    def subscribe(self, subscribe_requests):
        """
        Subscribe accounts.
        """
        response = self.call(
            self.client.service.subscribe,
            subscribe_requests)
        return response

    def update(self, z_objects):
        """
        Update z_objects.
        """
        response = self.call(
            self.client.service.update,
            z_objects)
        return response

    def __str__(self):
        """
        Display the client __str__ method.
        """
        return self.client.__str__()
开发者ID:a1ph4g33k,项目名称:zuora-client,代码行数:104,代码来源:client.py

示例3: execfile

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import __str__ [as 别名]
logging.basicConfig(level=logging.INFO)

wsdl_url='https://api.orgregister.1c.ru/orgregister/v2?wsdl'

conf = {}
execfile("./1c-its.conf", conf) # reading username, password

transport = HttpAuthenticated(username=conf['username'],
                              password=conf['password'])
headers = {'Content-Type': 'text/xml; charset=utf-8'}
#client = Client(url=wsdl_url, transport=transport, headers=headers, plugins=[utf_doc_plugin(), UTFPlugin()])
client = Client(url=wsdl_url, transport=transport, headers=headers, plugins=[UTFPlugin()])

# It works!
print '----- client -----'
cli_str=client.__str__()
print cli_str.encode('utf8')
print '----- End of client -----'

# Service ( RequisitesWebServiceEndpointImpl2Service ) tns="http://ws.orgregister.company1c.com/"
#   Prefixes (3)
#      ns0 = "http://company1c.com/orgregister/corporation"
#      ns2 = "http://company1c.com/orgregister/entrepreneur"
#      ns3 = "http://ws.orgregister.company1c.com/"
#   Ports (1):
#      (RequisitesWebServiceEndpointImpl2Port)
#         Methods (3):
#            getCorporationRequisitesByINN(xs:string INN, xs:string configurationName, )
#            getCorporationRequisitesByNameAndAddress(xs:string name, xs:string regionCode, xs:string address, xs:string configurationName, )
#            getEntrepreneurRequisitesByINN(xs:string INN, xs:string configurationName, )
#         Types (30):
开发者ID:vscherbo,项目名称:soap-1c,代码行数:33,代码来源:soap-1c.py


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