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


Python Client.last_received方法代码示例

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


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

示例1: createPayment

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
    def createPayment(self, amount, currency, cardNumber, expiryMonth, expiryYear, cardSecurityCode, scheme, orderId):
        """ Main method, performs a createRequest payment

        Keyword arguments:
        amount -- the payment amount
        currency -- the currency code (978 is for Euro)
        cardNumber -- the credit card number
        expiryMonth -- the month (MM) of the credit card expiry
        expiryYear -- the year (YYYY) of the credit card expiry
        cardSecurityCode -- the security code of the credit card
        scheme -- the scheme of the credit card (ie 'VISA')
        orderId -- the identifier of the order related to the requested payment

        Returns:
        SUDS answer
        """
        self.logger.info("'createPayment' requested for order id {} (amount: {}, currency: {})".format(orderId, amount, currency))
        # Create a SUDS client of the PayZen platform
        client = Client(url=self.platform['wsdl'])

        # Each request needs a timestamp
        timestamp = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ")

        # SOAP headers construction and definition
        headers = self.headers(timestamp)
        client.set_options(soapheaders=headers)

        # Builds the payload
        ## commonRequest part
        commonRequest = {'submissionDate': timestamp}

        ## paymentRequest part
        paymentRequest = {'amount': amount, 'currency': currency}

        ## orderRequest part
        orderRequest = {'orderId': orderId}

        ## cardRequest part
        cardRequest = {
            'number': cardNumber
            , 'expiryMonth': expiryMonth
            , 'expiryYear': expiryYear
            , 'cardSecurityCode': cardSecurityCode
           , 'scheme': scheme
        }

        # Performs the query
        answer = client.service.createPayment(
            commonRequest=commonRequest,
            paymentRequest=paymentRequest,
            cardRequest=cardRequest,
            orderRequest=orderRequest
        )

        # Validates the answer
        self.validate(client.last_received())
        self.logger.info("'createPayment' response for order id {} is valid".format(orderId))

        # Returns the answer
        return answer
开发者ID:LaurentGrimaud,项目名称:PayZen-Python-SOAP-V5-createPayment-example,代码行数:62,代码来源:PayZenSOAPV5ToolBox.py

示例2: SudsClient

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [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: __init__

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
class ManageSmsService:
    def __init__(self, username, password, host = 'http://ws.smshosting.it'):
        """ManageSmsService( username, password, host = 'http://ws.smshosting.it')

			Instantiates an instance of ManageSmsService.

			Parameters:
				username - Your SmsHosting.it username.
				password - Your SmsHosting.it secret key.
				host - Server address.
        """

        self.username = username
        self.password = password
        if host.endswith('/'):
            self.address = host + 'smsWebService/ManageSms?wsdl'
        else:
            self.address = host + '/smsWebService/ManageSms?wsdl'
        
		# Check and set up authentication
        if self.username is not None and self.password is not None:
			# Assume Basic authentication ritual
            self.client = Client(self.address)

        else:
            raise pySmsHostingError("Authentication failed with your provided credentials. Try again? (%s failure)" % `e.code`, e.code)
            
        self.numbers = self.client.factory.create('sendPayLoad')
        #print self.numbers

    def setNumber(self, number, customerId = None):
        
        phone = self.client.factory.create('msisdn')
        phone.customerId = customerId
        phone.number = number
        self.numbers.numbers.append(phone)
        
        return
        

    def send(self, text, sender = "SMSHosting.it", dateTime = None, groups = None, transactionId = None ):
        """send(xs:string password, xs:string username, xs:string dateTime, xs:string from, xs:string[] groups, msisdn[] numbers, xs:string text, xs:string transactionId, )
        """
        global errors

        try:        
            result = self.client.service.send(self.password, self.username, dateTime, sender, groups, self.numbers.numbers, text, transactionId)
            sent = self.client.last_sent()
            rcvd = self.client.last_received()
            #print '\nreply(\n%s\n)\n' % result
            return result
        
        except WebFault, f:
            errors += 1
            print f
            print f.fault
        except Exception, e:
            errors += 1
            print e
            tb.print_exc()
开发者ID:giasone,项目名称:pySMSHosting,代码行数:62,代码来源:smshosting.py

示例4: timbrar

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
  def timbrar(self, src, opciones = { 'generarCBB': False, 'generarTXT': False, 'generarPDF': False}):
    try:
      # en caso de que src sea una ruta a archivo y no una cadena, abrir y cargar ruta
      if os.path.isfile(src): src = open(src, 'r').read()
      opciones['text2CFDI'] = base64.b64encode(src)
      self.opciones.update(opciones)
      cliente = Client(self.url)
      respuesta = cliente.service.requestTimbrarCFDI(self.opciones)

      for propiedad in ['xml', 'pdf', 'png', 'txt']:
        if propiedad in respuesta:
          self.__dict__[propiedad] = base64.b64decode(respuesta[propiedad])

      if 'xml' in respuesta:
        xml_cfdi = ET.fromstring(self.xml)
        tfd = xml_cfdi.xpath('//tfd:TimbreFiscalDigital', namespaces={"tfd": "http://www.sat.gob.mx/TimbreFiscalDigital"})
        self.__dict__['uuid'] = tfd[0].get('UUID')

      if self.debug:
        self.logger.info("\nSOAP request:\n %s" % cliente.last_sent())
        self.logger.info("\nSOAP response:\n %s" % cliente.last_received())

      return True
    except WebFault, e:
      self.__dict__['codigo_error'] = e.fault.faultcode
      self.__dict__['error'] = e.fault.faultstring
      if self.debug:
        self.logger.error("\nSOAP request:\n %s\nSOAP response: [%s] - %s" % (cliente.last_sent(), e.fault.faultcode, e.fault.faultstring))
      return False
开发者ID:e-fector,项目名称:gnucash-cfdi,代码行数:31,代码来源:facturacion_moderna.py

示例5: SudsClient

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [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

示例6: Polarion

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
class Polarion(object):

    def __init__(self, url, username, password, query):
        self.url = url
        self.username = username
        self.password = password
        self.query = query #project.id:ProjectPeriod AND type:defect
        self.connected = True

        self.session = Client(self.url + '/ws/services/SessionWebService?wsdl') #http://10.0.0.1/polarion
        try:
            self.session.service.logIn(self.username, self.password)
            header_regex = re.compile('<ns1:sessionID.+>(.*)</ns1:sessionID')
            m=header_regex.search(self.session.last_received().str())
            sessionId=m.group(1)
            session_ns=('ns1', 'http://ws.polarion.com/session')
            self.sessionId = Element('sessionID', ns=session_ns).setText(sessionId)
        except:
            logger.error('Can not get the issues from ' + self.url + ' with the username ' + self.username)
            self.connected = False

    def getIssues(self):
        tracker = Client(self.url + '/ws/services/TrackerWebService?wsdl')
        tracker.set_options(soapheaders=self.sessionId)
        return tracker.service.queryWorkItems(self.query,'id',['id','title'])
开发者ID:akashagarwal,项目名称:qPaaS,代码行数:27,代码来源:Polarion.py

示例7: gpn

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
class gpn(Client):

    def __int__(self, username, password, url=None):
        """
        @param username: The username for the service.
        @type username: str
        @param password: The password for the service.
        @type password: str
        @param password: The password for the service.
        @type password: str
        @param url: The WSDL url for the service.
        @type url: str
        """
        self.username = username
        self.password = password
        self.url = url

    def __str__(self):
        return '[user: %s\tpassword: %s\twsdl: %s]' % (self.username,
                                                       self.password,
                                                       self.url)

    def service(self, transport=None):
        """
        The B{service} selector is used to select a web service.
        In most cases, the wsdl only defines (1) service in which access
        by subscript is passed through to a L{PortSelector}.  This is also the
        behavior when a I{default} service has been specified.  In cases
        where multiple services have been defined and no default has been
        specified, the service is found by name (or index) and a L{PortSelector}
        for the service is returned.  In all cases, attribute access is
        forwarded to the L{PortSelector} for either the I{first} service or the
        I{default} service (when specified).
        @ivar __client: A suds client.
        @type __client: L{Client}
        @ivar __services: A list of I{wsdl} services.
        @type __services: list
        """
        self.soapclient = Client(self.url)
        if transport:
            self.soapclient = Client(self.url, transport=None)
        return self.soapclient.service

    def last_sent(self):
        """
        Get last sent I{soap} message.
        @return: The last sent I{soap} message.
        @rtype: L{Document}
        """
        return self.soapclient.last_sent()

    def last_received(self):
        """
        Get last received I{soap} message.
        @return: The last received I{soap} message.
        @rtype: L{Document}
        """
        return self.soapclient.last_received()
开发者ID:httpstergeek,项目名称:compuware_apm_syn,代码行数:60,代码来源:gpn.py

示例8: consume_web_service

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
def consume_web_service(request):
	if request.is_ajax():
		ubigeo = request.GET['ubigeo']
		adress = request.GET['adress']
		
		url = 'Web Service a consumir :P'
		
		client = Client(url)

		geocodificarDireccion =  client.service.GeocodificarDireccion('1', ubigeo, adress)
		xmlRes = client.last_received()
		return HttpResponse(xmlRes, mimetype="application/xml")
	else:
		return Http404
开发者ID:mmaquera,项目名称:geolocalization_GoogleMap,代码行数:16,代码来源:views.py

示例9: WsTest

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
def WsTest(url,Wsname,data):
    '''
    :param url: wsdl地址
    :param Wsname: 方法名,做保存结果的文件名
    :param data: 方法的传入参数
    :return:
    '''
    client = Client(url)#创建一个webservice接口对象
    # print client
    client.service.getMobileCodeInfo(data)#调用这个接口下的getMobileCodeInfo方法,并传入参数
    req = str(client.last_sent())#保存请求报文,因为返回的是一个实例,所以要转换成str
    response = str(client.last_received())#保存返回报文,返回的也是一个实例
    print response#打印返回报文

    WriteRes(Wsname,req,response,data)#调用写入结果函数,把方法名、请求报文、返回报文、和入参传进去
开发者ID:zhoujinjian,项目名称:Python_Interface,代码行数:17,代码来源:testMobileCode.py

示例10: FlyDocService

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
class FlyDocService(object):
    """
    Base for FlyDoc services classes
    Loads the WSDL file at instanciation and defines some helpers to simplify written code
    """
    def __init__(self, wsdlFile):
        self.client = Client(wsdlFile)

    def _create(self, name, values=None):
        """
        Creates, and optioally populates, a new complex type instance
        """
        if values is None:
            values = {}

        value = self.client.factory.create(name)
        for key, val in values.items():
            value[key] = val

        return value

    def _getLastResponseHeaders(self):
        """
        Returns the headers of the last received response
        """
        return self.client.last_received().getChild('Envelope').getChild('Header')

    def _addHeader(self, headerName, headerValue):
        """
        Add a header for the soap query
        """
        headers = self.client.options.soapheaders
        if not isinstance(headers, dict):
            headers = {}
        headers.update({headerName: headerValue})
        self.client.set_options(soapheaders=headers)

    def __getattr__(self, name):
        """
        Binds method calls on the class, and all other calls prefixed by an underscore
        """
        if name.startswith('_') and hasattr(self.client, name[1:]):
            return getattr(self.client, name[1:])

        if hasattr(self.client.service, name):
            return getattr(self.client.service, name)

        raise AttributeError('Unknown attribute %s' % name)
开发者ID:syleam,项目名称:pyFlyDoc,代码行数:50,代码来源:__init__.py

示例11: cancelar

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
 def cancelar(self, uuid):
   try:
     cliente = Client(self.url)
     opciones = {'uuid': uuid}
     opciones.update(self.opciones)
     respuesta = cliente.service.requestCancelarCFDI(opciones)
     if self.debug:
       self.logger.info("\nSOAP request:\n %s" % cliente.last_sent())
       self.logger.info("\nSOAP response:\n %s" % cliente.last_received())
     return True
   except WebFault, e:
     self.__dict__['codigo_error'] = e.fault.faultcode
     self.__dict__['error'] = e.fault.faultstring
     if self.debug:
       self.logger.error("\nSOAP request:\n %s\nSOAP response: [%s] - %s" % (cliente.last_sent(), e.fault.faultcode, e.fault.faultstring))
     return False
开发者ID:e-fector,项目名称:gnucash-cfdi,代码行数:18,代码来源:facturacion_moderna.py

示例12: query

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
def query (message): 
#	url = "http://localhost:1104/axis2/services/AuthzService?wsdl"
#	url = "http://localhost/axis2/services/AuthzService?wsdl"
	url = "http://permis.dyndns.org/axis2/services/AuthzService?wsdl"
	client = Client(url)
	client.service.XACMLAuthzRequest(__inject={'msg':message.encode()})
	recvdata = client.last_received() 
#	senddata = client.last_sent() 
#	f = file('ss.txt', 'wb') 
#	f.write(str(senddata)) 
#	f.close() 
#	print senddata 
#	print '--------------------------------' 
#	print recvdata
#	print '--------------------------------' 
	return recvdata 
开发者ID:song10,项目名称:health-data-access-control-with-PERMIS,代码行数:18,代码来源:request.py

示例13: activarCancelacion

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
 def activarCancelacion(self, archCer, archKey, passKey):
   try:
     # en caso de que archCer y/o archKey sean una ruta a archivo y no una cadena, abrir y cargar ruta
     if os.path.isfile(archCer): archCer = open(archCer, 'r').read()
     if os.path.isfile(archKey): archKey = open(archKey, 'r').read()
     opciones = {}
     opciones['archivoKey'] = base64.b64encode(archKey)
     opciones['archivoCer'] = base64.b64encode(archCer)
     opciones['clave'] = passKey
     self.opciones.update(opciones)
     cliente = Client(self.url)
     respuesta = cliente.service.activarCancelacion(self.opciones)
     if self.debug:
       self.logger.info("\nSOAP request:\n %s" % cliente.last_sent())
       self.logger.info("\nSOAP response:\n %s" % cliente.last_received())
     return True
   except WebFault, e:
     self.__dict__['codigo_error'] = e.fault.faultcode
     self.__dict__['error'] = e.fault.faultstring
     if self.debug:
       self.logger.error("\nSOAP request:\n %s\nSOAP response: [%s] - %s" % (cliente.last_sent(), e.fault.faultcode, e.fault.faultstring))
     return False
开发者ID:e-fector,项目名称:gnucash-cfdi,代码行数:24,代码来源:facturacion_moderna.py

示例14: WebService

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
class WebService(object):
    def __init__(self, url, use_real_url, **kwargs):
        self.use_real_url = use_real_url
        self.suds_client = Client(url, timeout=180, **kwargs) # default suds transport timeout is 90 seconds
        self.service_url = str(url.replace('?wsdl', '')) # to work around erp tunnel port not preserved bug

    def new_object_of_type(self, wsdl_type, returns_dict_object=False):
        suds_object = self.suds_client.factory.create(wsdl_type)
        if returns_dict_object:
            return DictObject(self.suds_client.dict(suds_object))
        return suds_object

    def last_sent(self):
        return self.suds_client.last_sent()

    def last_received(self):
        return self.suds_client.last_received()

    def __getattr__(self, item):
        service = getattr(self.suds_client.service, item)
        if not self.use_real_url:
            service.method.location = self.service_url
        return service
开发者ID:chenxc,项目名称:veil,代码行数:25,代码来源:web_service.py

示例15: EIF038PartyActivityInformationProvider

# 需要导入模块: from suds.client import Client [as 别名]
# 或者: from suds.client.Client import last_received [as 别名]
class EIF038PartyActivityInformationProvider(PartyActivityInformationProvider):

    name = u'EIF038 Web Services'
    _client = None
    _namespace = 'rif'
    _uri = 'http://ands.org.au/standards/rif-cs/registryObjects'

    def __init__(self):

        # Basic info
#        url = "http://mobs-qa.its.monash.edu.au:7778/"\
#             "esb/wsil/AI/ResearchMaster/AIRMANDSService_RS?wsdl"

        #url = "http://mobs-dev.its.monash.edu.au:7778/esb/wsil"\
        #    "/AI/ResearchMaster/AIRMANDSService_RS?wsdl"

        url = "http://mobs.its.monash.edu.au:7778/orabpel/"\
              "ResearchMaster/AIRMANDSService/AIRMANDSService?wsdl"

        self._client = Client(url)

    def get_unique_party_id(self, username):
        """
        return the user dictionary in the format of::

        """
        response = self._client.service.getNlaId(username)

        return response.pnlaidOut.nlaId

    def get_party_rifcs(self, unique_party_id):
        """
        return the user dictionary in the format of::


        """
        self._client.service.getPartyregistryobject(unique_party_id)
        xmldata = self._client.last_received()
        #print xmldata

        regObj = xmldata.childAtPath('Envelope/Body/registryObjects')
        regObj.applyns((self._namespace, self._uri))
        regObj.walk(visitor)
        return regObj.str()

    def get_display_name_for_party(self, unique_party_id):
        """
        return the user dictionary in the format of::


        """
        self._client.service.getPartyregistryobject(unique_party_id)
        xmldata = self._client.last_received()
        #print xmldata

        regObj = xmldata.childAtPath('Envelope/Body/registryObjects/registryObject')

        from lxml import etree
        import StringIO
        
        rif_tree = etree.parse(StringIO.StringIO(regObj))
        title = rif_tree.xpath('//name/namePart[@type="title"]/text()')[0]
        given = rif_tree.xpath('//name/namePart[@type="given"]/text()')[0]
        family = rif_tree.xpath('//name/namePart[@type="family"]/text()')[0]
        
        return title + " " + given + " " + family

    def get_activity_summary_dict(self, username):
        """
        return the user dictionary in the format of::


        """
        try:
            projects = self._client.service.getProjects(username)
            return projects.pprojectsOut
        except suds.WebFault:
            return {}

    def get_activity_rifcs(self, activity_id):
        """
        return the user dictionary in the format of::


        """
        self._client.service.getActivityregistryobject(activity_id)
        xmldata = self._client.last_received()
        #print xmldata

        regObj = xmldata.childAtPath('Envelope/Body/registryObjects')
        regObj.applyns((self._namespace, self._uri))
        regObj.walk(visitor)
        return regObj.str()
开发者ID:steveandroulakis,项目名称:monash_ands-app,代码行数:95,代码来源:EIF038PartyActivityInformationProvider.py


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