events: rename input/output XMLs for easier reading
This commit is contained in:
parent
8eb4d2035e
commit
fc29f1a2e6
23
events.py
23
events.py
@ -49,19 +49,22 @@ eventStrings = {
|
|||||||
|
|
||||||
#<?xml version="1.0" encoding="UTF-8"?><VertXMessage xmlns:hid="http://www.hidcorp.com/VertX"><hid:EventMessages action="RL" historyRecordMarker="463" historyTimestamp="1525824431" currentRecordMarker="463" currentTimestamp="1525824431" /></VertXMessage>
|
#<?xml version="1.0" encoding="UTF-8"?><VertXMessage xmlns:hid="http://www.hidcorp.com/VertX"><hid:EventMessages action="RL" historyRecordMarker="463" historyTimestamp="1525824431" currentRecordMarker="463" currentTimestamp="1525824431" /></VertXMessage>
|
||||||
|
|
||||||
XML = ET.Element("VertXMessage")
|
# get parameters for messages to get?
|
||||||
ET.SubElement(XML, "hid:EventMessages", attrib={"action": "LR"})
|
# honestly not really sure why this is required, their API is confusing
|
||||||
xml = doXMLRequest(TARGET_IP, ET.tostring(XML))
|
parXMLIn = ET.Element("VertXMessage")
|
||||||
print(xml[0].attrib)
|
ET.SubElement(parXMLIn, "hid:EventMessages", attrib={"action": "LR"})
|
||||||
|
parXMLOut = doXMLRequest(TARGET_IP, ET.tostring(parXMLIn))
|
||||||
|
|
||||||
XML = ET.Element("VertXMessage")
|
# get the actual messages
|
||||||
ET.SubElement(XML, "hid:EventMessages",
|
eventsXMLIn = ET.Element("VertXMessage")
|
||||||
|
ET.SubElement(eventsXMLIn, "hid:EventMessages",
|
||||||
attrib={"action": "LR",
|
attrib={"action": "LR",
|
||||||
"recordCount": "1000",
|
"recordCount": "1000",
|
||||||
"historyRecordMarker": xml[0].attrib["historyRecordMarker"],
|
"historyRecordMarker": parXMLOut[0].attrib["historyRecordMarker"],
|
||||||
"historyTimestamp": xml[0].attrib["historyTimestamp"]})
|
"historyTimestamp": parXMLOut[0].attrib["historyTimestamp"]})
|
||||||
xml = doXMLRequest(TARGET_IP, ET.tostring(XML))
|
eventsXMLOut = doXMLRequest(TARGET_IP, ET.tostring(eventsXMLIn))
|
||||||
for event in xml[0]:
|
|
||||||
|
for event in eventsXMLOut[0]:
|
||||||
ET.dump(event)
|
ET.dump(event)
|
||||||
att = event.attrib
|
att = event.attrib
|
||||||
eventType = int(att["eventType"])
|
eventType = int(att["eventType"])
|
||||||
|
Reference in New Issue
Block a user