예제 #1
0
 def to_xml(self):
     ctl = ET.Element('ctl', {'td': self.name})
     for key, value in self.args.items():
         if type(value) is dict:
             inner = ET.Element(key, value)
             ctl.append(inner)
         else:
             ctl.set(key, value)
     return ctl
예제 #2
0
파일: __init__.py 프로젝트: uchagani/sucks
    def to_xml(self):
        ctl = ET.Element('ctl', {'td': self.name})
        for key, value in self.args.items():
            if type(value) is dict:
                inner = ET.Element(key, value)
                ctl.append(inner)
            elif type(value) is list:
                for item in value:
                    ixml = self.listobject_to_xml(key, item)
                    ctl.append(ixml)
            else:
                ctl.set(key, value)

        return ctl
예제 #3
0
파일: __init__.py 프로젝트: uchagani/sucks
 def listobject_to_xml(self, tag, conv_object):
     rtnobject = ET.Element(tag)
     if type(conv_object) is dict:
         for key, value in conv_object.items():
             rtnobject.set(key, value)
     else:
         rtnobject.set(tag, conv_object)
     return rtnobject
예제 #4
0
 def send_ping(self, to):
     q = self.make_iq_get(ito=to, ifrom=self._my_address())
     q.xml.append(ET.Element('ping', {'xmlns': 'urn:xmpp:ping'}))
     _LOGGER.debug("*** sending ping ***")
     q.send()