コード例 #1
0
ファイル: wsse.py プロジェクト: mgmtech/FuelSDK-Python
 def xml(self):
     root = Element("Timestamp", ns=wsuns)
     created = Element('Created', ns=wsuns)
     created.setText(str(UTC(self.created)))
     expires = Element('Expires', ns=wsuns)
     expires.setText(str(UTC(self.expires)))
     root.append(created)
     root.append(expires)
     return root
コード例 #2
0
ファイル: wsse.py プロジェクト: ketralnis/FuelSDK-Python
 def xml(self):
     root = Element("Timestamp", ns=wsuns)
     created = Element('Created', ns=wsuns)
     created.setText(str(UTC(self.created)))
     expires = Element('Expires', ns=wsuns)
     expires.setText(str(UTC(self.expires)))
     root.append(created)
     root.append(expires)
     return root
コード例 #3
0
ファイル: binding.py プロジェクト: mgmtech/FuelSDK-Python
 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
コード例 #4
0
ファイル: binding.py プロジェクト: mgmtech/FuelSDK-Python
 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
コード例 #5
0
ファイル: wsse.py プロジェクト: mgmtech/FuelSDK-Python
 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
コード例 #6
0
ファイル: binding.py プロジェクト: ketralnis/FuelSDK-Python
 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
コード例 #7
0
ファイル: binding.py プロジェクト: ketralnis/FuelSDK-Python
 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
コード例 #8
0
ファイル: wsse.py プロジェクト: ketralnis/FuelSDK-Python
 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
コード例 #9
0
ファイル: parser.py プロジェクト: ketralnis/FuelSDK-Python
 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)
     node.charbuffer = []
     top.append(node)
     self.push(node)
コード例 #10
0
ファイル: parser.py プロジェクト: mgmtech/FuelSDK-Python
 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)
     node.charbuffer = []
     top.append(node)
     self.push(node)
コード例 #11
0
ファイル: binding.py プロジェクト: mgmtech/FuelSDK-Python
 def envelope(self, header, body):
     """
     Build the B{<Envelope/>} for an soap outbound message.
     @param header: The soap message B{header}.
     @type header: L{Element}
     @param body: The soap message B{body}.
     @type body: L{Element}
     @return: The soap envelope containing the body and header.
     @rtype: L{Element}
     """
     env = Element('Envelope', ns=envns)
     env.addPrefix(Namespace.xsins[0], Namespace.xsins[1])
     env.append(header)
     env.append(body)
     return env
コード例 #12
0
ファイル: binding.py プロジェクト: ketralnis/FuelSDK-Python
 def envelope(self, header, body):
     """
     Build the B{<Envelope/>} for an soap outbound message.
     @param header: The soap message B{header}.
     @type header: L{Element}
     @param body: The soap message B{body}.
     @type body: L{Element}
     @return: The soap envelope containing the body and header.
     @rtype: L{Element}
     """
     env = Element('Envelope', ns=envns)
     env.addPrefix(Namespace.xsins[0], Namespace.xsins[1])
     env.append(header)
     env.append(body)
     return env
コード例 #13
0
ファイル: ET_Client.py プロジェクト: ketralnis/FuelSDK-Python
    def build_soap_client(self):
        if self.endpoint is None:
            self.endpoint = self.determineStack()

        self.authObj = {'oAuth' : {'oAuthToken' : self.internalAuthToken}}
        self.authObj['attributes'] = { 'oAuth' : { 'xmlns' : 'http://exacttarget.com' }}

        self.soap_client = et_suds.client.Client(self.wsdl_file_url, faults=False, cachingpolicy=1)
        self.soap_client.set_options(location=self.endpoint)

        element_oAuth = Element('oAuth', ns=('etns', 'http://exacttarget.com'))
        element_oAuthToken = Element('oAuthToken').setText(self.internalAuthToken)
        element_oAuth.append(element_oAuthToken)
        self.soap_client.set_options(soapheaders=(element_oAuth))

        security = et_suds.wsse.Security()
        token = et_suds.wsse.UsernameToken('*', '*')
        security.tokens.append(token)
        self.soap_client.set_options(wsse=security)
コード例 #14
0
ファイル: wsse.py プロジェクト: mgmtech/FuelSDK-Python
 def xml(self):
     """
     Get xml representation of the object.
     @return: The root node.
     @rtype: L{Element}
     """
     root = Element('UsernameToken', ns=wssens)
     u = Element('Username', ns=wssens)
     u.setText(self.username)
     root.append(u)
     p = Element('Password', ns=wssens)
     p.setText(self.password)
     root.append(p)
     if self.nonce is not None:
         n = Element('Nonce', ns=wssens)
         n.setText(self.nonce)
         root.append(n)
     if self.created is not None:
         n = Element('Created', ns=wsuns)
         n.setText(str(UTC(self.created)))
         root.append(n)
     return root
コード例 #15
0
ファイル: wsse.py プロジェクト: ketralnis/FuelSDK-Python
 def xml(self):
     """
     Get xml representation of the object.
     @return: The root node.
     @rtype: L{Element}
     """
     root = Element('UsernameToken', ns=wssens)
     u = Element('Username', ns=wssens)
     u.setText(self.username)
     root.append(u)
     p = Element('Password', ns=wssens)
     p.setText(self.password)
     root.append(p)
     if self.nonce is not None:
         n = Element('Nonce', ns=wssens)
         n.setText(self.nonce)
         root.append(n)
     if self.created is not None:
         n = Element('Created', ns=wsuns)
         n.setText(str(UTC(self.created)))
         root.append(n)
     return root