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
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
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
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()