class GetAlertDefinitions(object): """docstring for GetAlertDefinitions""" def __init__(self, host): super(GetAlertDefinitions, self).__init__() self.getTuple() self.g = Get() assert host self.host = host def getTuple(self): """docstring for getTuple""" for line in sys.stdin: line = line.strip() platformName, resourceId = line.split() yield (platformName, resourceId) def runSQL(self): """docstring for runSQL""" for platformName, resourceId in self.getTuple(): url = r"http://%s:7080/hqu/hqapi1/alertdefinition/listDefinitions.hqu?resourceId=%s&children=true&verbose=true" % (self.host, resourceId) filename = platformName + ".xml" print " Now processing .. " print filename print url print resourceId file = open("data/" + filename, 'w') data = self.g.get(url) file.write(xml.dom.minidom.parseString(data).toprettyxml()) print " filename done .. " print "==========================="
def runSQL(item): g = Get() host = "host" """docstring for runSQL""" platformName, resourceId = item url = r"http://%s:7080/hqu/hqapi1/resource/get.hqu?id=%s&children=true&verbose=true" % (host, resourceId) filename = platformName + ".resource.xml" print " Now processing .. " print filename print url print resourceId file = open("data/" + filename, 'w') data = g.get(url) file.write(xml.dom.minidom.parseString(data).toprettyxml()) print filename + " done .. "
def runSQL(item): g = Get() host = "host" """docstring for runSQL""" platformName, resourceId = item url = r"http://%s:7080/hqu/hqapi1/alertdefinition/listDefinitions.hqu?resourceId=%s&children=true&verbose=true" % ( host, resourceId, ) filename = platformName + ".xml" print " Now processing .. " print filename print url print resourceId file = open("data/" + filename, "w") data = g.get(url) file.write(xml.dom.minidom.parseString(data).toprettyxml().encode("utf-8")) print filename + " done .. "