def _build_command(self, cmd, params, options, remote_target=None): root = etree.Element("command", id=str(next(self._cmdindex)), type=cmd, close_on_return="no") if remote_target: root.attrib["remote_target"] = remote_target for k, v in options.items(): root.append( etree.Element("option", name=self._dump_xcli(k), value=self._dump_xcli(v))) for k, v in params.items(): root.append( etree.Element("argument", name=self._dump_xcli(k), value=self._dump_xcli(v))) data = etree.tostring(root) if ("password" in options): data = data.decode() data.replace(options["password"], "XXX") data.encode() anon = data xlog.debug("SEND %s" % (anon)) return data
def __str__(self): ret_str = "" if isinstance(self.xml, str): ret_str = "%s\n\n%s" % (self.status, self.xml) else: ret_str = "%s\n\n%s" % (etree.tostring(self.xml)) return ret_str
def __str__(self): ret_str = "" if isinstance(self.xml, str): ret_str = "%s\n\n%s" % (self.status, self.xml) else: ret_str = "%s\n\n%s" % (etree.tostring(self.xml)) return ret_str
def _build_command(self, cmd, params, options, remote_target=None): root = etree.Element("command", id=str(self._cmdindex.next()), type=cmd, close_on_return="no") if remote_target: root.attrib["remote_target"] = remote_target for k, v in options.items(): root.append(etree.Element("option", name=self._dump_xcli(k), value=self._dump_xcli(v))) for k, v in params.items(): root.append(etree.Element("argument", name=self._dump_xcli(k), value=self._dump_xcli(v))) data = etree.tostring(root) anon = data.replace(options["password"], "XXX") if "password" in options else data xlog.debug("SEND %s" % (anon)) return data
def __str__(self): return etree.tostring(self.response_etree)
def __str__(self): return etree.tostring(self.response_etree)