• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python element.Element类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中suds.sax.element.Element的典型用法代码示例。如果您正苦于以下问题:Python Element类的具体用法?Python Element怎么用?Python Element使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: main

	def main(self):
		items = self.adsm_lists.service.GetListItems(self.args.list, self.args.view).listitems.data.row

		method_idx = 1
		batch = Element('Batch')\
		       .append(Attribute('OnError', 'Continue'))\
		       .append(Attribute('ListVersion', 1))

		def update(b):
			if not self.args.d:
				updates = Element('ns1:updates').append(b)
				print self.adsm_lists.service.UpdateListItems(listName=self.args.list, updates=updates)

		for item in items:
			method = Element('Method')\
			        .append(Attribute('ID', method_idx))\
			        .append(Attribute('Cmd', 'Delete'))\
			        .append(Element('Field')\
			          .append(Attribute('Name', 'ID'))\
			          .setText(item['_ows_ID']))
			batch.append(method)
			print method
			method_idx += 1

			if len(batch) > 20:
				update(batch)
				batch.detachChildren()

		if len(batch) > 0:
			update(batch)
开发者ID:kinghuang,项目名称:itsm,代码行数:30,代码来源:delete-items.py


示例2: init_client

def init_client(faults=True):
    ENTREPRISE_WSDL = getattr(settings,     'SALESFORCE_ENTERPRISE_WSDL')
    DJANGO_WSDL = getattr(settings,         'SALESFORCE_DJANGO_WSDL')
    SALESFORCE_ENDPOINT = getattr(settings, 'SALESFORCE_ENDPOINT')
    
    SALESFORCE_USER = getattr(settings,     'SALESFORCE_USER')
    SALESFORCE_PASS = getattr(settings,     'SALESFORCE_PASS')
    SALESFORCE_TOKEN = getattr(settings,    'SALESFORCE_TOKEN')
    
    # Use the entreprise login to get a session id
    entreprise_client = Client(ENTREPRISE_WSDL)
    #entreprise_client.wsdl.url = SALESFORCE_ENDPOINT
    
    login_result = entreprise_client.service.login(SALESFORCE_USER, 
                                                   SALESFORCE_PASS+SALESFORCE_TOKEN)
    

    # our client specific methods are in this specific       
   
    # NOTE we have to create the endpoint url using values from the serverUrl in the loginResponse plus 
    # the djangoAdapter schema
    
    options = urlparse(login_result.serverUrl)
    
    #DJANGO_SF_ENDPOINT = '%s://%s/services/Soap/class/dJangoAdapter' % (options.scheme, options.netloc)
    
    django_client = Client(DJANGO_WSDL, location = SALESFORCE_ENDPOINT, faults=faults)
         
    session_name_space = ('djan', 'http://soap.sforce.com/schemas/class/dJangoAdapter')
    session = Element('sessionId').setText(login_result.sessionId)
    wrapper = Element('SessionHeader')
    wrapper.append(session)
    
    django_client.set_options(soapheaders=wrapper)
    return django_client
开发者ID:jason5001001,项目名称:savings-champion,代码行数:35,代码来源:salesforce_sync.py


示例3: set_auth_header

 def set_auth_header(self):
     """Set up the authorization header"""
     auth_user = Element("username").setText(self.api_user)
     auth_key = Element("apiKey").setText(self.api_key)
     auth_header = Element("authenticate", ns=self.ims_ns)
     auth_header.children = [auth_user, auth_key]
     return auth_header
开发者ID:enygma,项目名称:slsoap,代码行数:7,代码来源:slsoap.py


示例4: encryptMessage

    def encryptMessage(self, env, use_encrypted_header=False, second_pass=False):
        encrypted_parts = second_pass and self.second_pass_encrypted_parts or self.encrypted_parts
        elements_to_encrypt = []
        encrypted_headers = []

        for elements_to_encrypt_func in encrypted_parts:
            addl_elements = elements_to_encrypt_func(env)
            if addl_elements[0] is None:
                continue
            if not isinstance(addl_elements[0], list):
                addl_elements = ([addl_elements[0]], addl_elements[1])
            for element in addl_elements[0]:
                if element not in elements_to_encrypt:
                    if element[0].parent.match("Header") and use_encrypted_header:
                        enc_hdr = Element("EncryptedHeader", ns=wsse11ns)
                        element[0].parent.replaceChild(element[0], enc_hdr)
                        enc_hdr.append(element[0])
                        elements_to_encrypt.append((enc_hdr, "Content"))
                        encrypted_headers.append(enc_hdr)
                    else:
                        elements_to_encrypt.append((element, addl_elements[1]))

        ref_list = xmlsec.encryptMessage(
            self.cert, self.symmetricKey, elements_to_encrypt, "#" + self.keyId, self.keyReference, self.keyTransport
        )

        for enc_hdr in encrypted_headers:
            enc_hdr.set("wsu:Id", enc_hdr[0].get("Id"))
            enc_hdr[0].unset("Id")
        if self.includeRefList:
            self.encryptedKey.append(ref_list)
            return self.encryptedKey
        else:
            return (self.encryptedKey, ref_list)
开发者ID:evandeaubl,项目名称:suds,代码行数:34,代码来源:__init__.py


示例5: testWSDL

def testWSDL(wsdlURL):
  replyURL = 'http://wsamplification.appspot.com/?webservice=' + wsdlURL
  try:
    client = Client(wsdlURL)    
    wsans = ('wsa', 'http://schemas.xmlsoap.org/ws/2004/08/addressing')
    wsaReply = Element('ReplyTo', ns=wsans)
    wsaAddress = Element('Address', ns=wsans).setText(replyURL)
    wsaReply.insert(wsaAddress)
  except:
    print 'Moving on...'
    return
  try:
    client.set_options(soapheaders=wsaReply) 
    #impl = getattr(client.service, 'submitOrderNoAck')
    #print impl()
    for method in client.wsdl.services[0].ports[0].methods.values():
      print method.name
      result = getattr(client.service, method.name)()
      #print result()
  except suds.WebFault as detail:
    print 'Invoking method failed'
    print client
  except:
    print 'Derping...'
    print client
开发者ID:zsmahi,项目名称:WS-Amplification,代码行数:25,代码来源:WSA_spoof.py


示例6: marshalled

    def marshalled(self, context):
        userid = self.userid
        timestamp = rfc3339(datetime.datetime.now())
        secret = self.secret
        signature = sign(secret, timestamp+userid)
        auth = self.authfragment % locals()
        envelope = context.envelope

        #Set the right ns prefixes
        envelope.nsprefixes[ 'ns1' ] = envelope.nsprefixes[ 'ns0' ]
        envelope.clearPrefix( 'ns0' )

        #Add our auth to the header element
        header = envelope.getChild('Header')
        authns = Element( 'ns1:AuthenticationHeader' )
        authns.append( Element( 'mktowsUserId' ).setText(self.userid) )
        authns.append( Element( 'requestSignature' ).setText(signature) )
        authns.append( Element( 'requestTimestamp' ).setText(timestamp) )
        header.append( authns )

        #Set the proper body prefixes
        body = envelope.getChild( 'Body' )
        body.prefix = 'SOAP-ENV'
        body.children[0].prefix = 'ns1'

        if self.debug:
            with open("/tmp/envelope.txt","w") as f: f.write(envelope.str())
开发者ID:sirsgriffin,项目名称:pymarketo,代码行数:27,代码来源:client.py


示例7: set_object_mask

 def set_object_mask(self, data):
     """Create an object mask to tell the API what we want"""
     print "%sObjectMask" % self.object_type
     el = Element("%sObjectMask" % self.object_type, ns=self.ims_ns)
     mask = Element("mask")
     mask = self.build_soap_header(mask, data)
     el.children = [mask]
     return el
开发者ID:enygma,项目名称:slsoap,代码行数:8,代码来源:slsoap.py


示例8: to_xml

    def to_xml(self, factory):
        # Needs to be an xsd:int with an attribute
        # Can't do that with factory.create('ns0:quantity')
        #metadata = factory.resolver.find('ns0:quantity')
        #ns = metadata.namespace()

        element = Element('ns0:quantity')
        element.setText(str(self.value))
        element.set('unitOfMeasure', self.unit)
        return element
开发者ID:jklardie,项目名称:django-oscar-docdata,代码行数:10,代码来源:gateway.py


示例9: node

 def node(self, content):
     ns = content.type.namespace()
     if content.type.form_qualified:
         node = Element(content.tag, ns=ns)
         node.addPrefix(ns[0], ns[1])
     else:
         node = Element(content.tag)
     self.encode(node, content)
     log.debug('created - node:\n%s', node)
     return node
开发者ID:bigbang4u2,项目名称:mywork,代码行数:10,代码来源:literal.py


示例10: xml

 def xml(self):
     """
     Get xml representation of the object.
     @return: The root node.
     @rtype: L{Element}
     """
     root = Element('Security', ns=wssens)
     root.set('mustUnderstand', str(self.mustUnderstand).lower())
     for t in self.tokens:
         root.append(t.xml())
     return root
开发者ID:BhallaLab,项目名称:moose-gui,代码行数:11,代码来源:wsse.py


示例11: header

 def header(self, content):
     """
     Build the B{<Body/>} for an soap outbound message.
     @param content: The header content.
     @type content: L{Element}
     @return: the soap body fragment.
     @rtype: L{Element}
     """
     header = Element('Header', ns=envns)
     header.append(content)
     return header
开发者ID:propars,项目名称:python-suds,代码行数:11,代码来源:binding.py


示例12: body

 def body(self, content):
     """
     Build the B{<Body/>} for an soap outbound message.
     @param content: The body content.
     @type content: L{Element}
     @return: the soap body fragment.
     @rtype: L{Element}
     """
     body = Element('Body', ns=envns)
     body.append(content)
     return body
开发者ID:propars,项目名称:python-suds,代码行数:11,代码来源:binding.py


示例13: connect

 def connect(self):
     from .client import SmsClient
     from suds.sax.element import Element
     self.client = SmsClient(self._vim.server_fqdn)
     session = eval(list(self._vim.client.client.options.transport.cookiejar)[0].value)
     cookie = Element("vcSessionCookie")
     cookie.setText(session)
     self.client.wsdl.options.__pts__.set("soapheaders", cookie)
     ref = Property('ServiceInstance')
     ref._type = 'ServiceInstance'
     self.service_instance = SmsServiceInstance(self, name='ServiceInstance', ref=ref)
     self.connected = True
开发者ID:Infinidat,项目名称:pyvisdk,代码行数:12,代码来源:core.py


示例14: set_session

 def set_session(self, session_id):
     """
     Record the session info.
     """
     self.session = session_id
     self.session_expiration = datetime.now() + timedelta(
         seconds=self.session_duration)
     session_namespace = ('ns1', 'http://api.zuora.com/')
     session = Element('session', ns=session_namespace).setText(session_id)
     header = Element('SessionHeader', ns=session_namespace)
     header.append(session)
     self.client.set_options(soapheaders=[header])
开发者ID:a1ph4g33k,项目名称:zuora-client,代码行数:12,代码来源:client.py


示例15: startElement

 def startElement(self, name, attrs):
     top = self.top()
     node = Element(unicode(name), parent=top)
     for a in attrs.getNames():
         n = unicode(a)
         v = unicode(attrs.getValue(a))
         attribute = Attribute(n,v)
         if self.mapPrefix(node, attribute):
             continue
         node.append(attribute)
     top.append(node)
     self.push(node)
开发者ID:tic-ull,项目名称:defensatfc-proto,代码行数:12,代码来源:parser.py


示例16: add

 def add(self, root):
     """
     Add an <xs:import/> to the specified schema root.
     @param root: A schema root.
     @type root: L{Element}
     """
     node = Element('import', ns=self.xsdns)
     node.set('namespace', self.ns)
     if self.location is not None:
         node.set('schemaLocation', self.location)
     log.debug('%s inserted', node)
     root.insert(node) 
开发者ID:chalkchisel,项目名称:suds,代码行数:12,代码来源:doctor.py


示例17: body

    def body(self, content):
        """
        Build the B{<Body/>} for a SOAP outbound message.

        @param content: The body content.
        @type content: L{Element}
        @return: The SOAP body fragment.
        @rtype: L{Element}

        """
        body = Element("Body", ns=envns)
        body.append(content)
        return body
开发者ID:EASYMARKETING,项目名称:suds-jurko,代码行数:13,代码来源:binding.py


示例18: startElement

 def startElement(self, name, attrs):
     top = self.top()
     node = Element(str(name))
     for a in attrs.getNames():
         n = str(a)
         v = str(attrs.getValue(a))
         attribute = Attribute(n,v)
         if self.mapPrefix(node, attribute):
             continue
         node.append(attribute)
     node.charbuffer = []
     top.append(node)
     self.push(node)
开发者ID:USGM,项目名称:suds,代码行数:13,代码来源:parser.py


示例19: xml

 def xml(self):
     root = Element("Timestamp", ns=wsuns)
     # xsd:datetime format does not have fractional seconds
     created = Element("Created", ns=wsuns)
     created.setText(str(UTC(self.created - timedelta(microseconds=self.created.microsecond))))
     expires = Element("Expires", ns=wsuns)
     expires.setText(str(UTC(self.expires - timedelta(microseconds=self.expires.microsecond))))
     root.append(created)
     root.append(expires)
     return root
开发者ID:evandeaubl,项目名称:suds,代码行数:10,代码来源:__init__.py


示例20: node

 def node(self, content):
     #
     # Create an XML node and namespace qualify as defined
     # by the schema (elementFormDefault).
     #
     ns = content.type.namespace()
     if content.type.form_qualified:
         node = Element(content.tag, ns=ns)
         node.addPrefix(ns[0], ns[1])
     else:
         node = Element(content.tag)
     self.encode(node, content)
     log.debug('created - node:\n%s', node)
     return node
开发者ID:dvska,项目名称:suds-htj,代码行数:14,代码来源:literal.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python parser.Parser类代码示例发布时间:2022-05-27
下一篇:
Python sax.Namespace类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap