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 = ET.Element("VertXMessage")
|
||||
ET.SubElement(XML, "hid:EventMessages", attrib={"action": "LR"})
|
||||
xml = doXMLRequest(TARGET_IP, ET.tostring(XML))
|
||||
print(xml[0].attrib)
|
||||
# get parameters for messages to get?
|
||||
# honestly not really sure why this is required, their API is confusing
|
||||
parXMLIn = ET.Element("VertXMessage")
|
||||
ET.SubElement(parXMLIn, "hid:EventMessages", attrib={"action": "LR"})
|
||||
parXMLOut = doXMLRequest(TARGET_IP, ET.tostring(parXMLIn))
|
||||
|
||||
XML = ET.Element("VertXMessage")
|
||||
ET.SubElement(XML, "hid:EventMessages",
|
||||
# get the actual messages
|
||||
eventsXMLIn = ET.Element("VertXMessage")
|
||||
ET.SubElement(eventsXMLIn, "hid:EventMessages",
|
||||
attrib={"action": "LR",
|
||||
"recordCount": "1000",
|
||||
"historyRecordMarker": xml[0].attrib["historyRecordMarker"],
|
||||
"historyTimestamp": xml[0].attrib["historyTimestamp"]})
|
||||
xml = doXMLRequest(TARGET_IP, ET.tostring(XML))
|
||||
for event in xml[0]:
|
||||
"historyRecordMarker": parXMLOut[0].attrib["historyRecordMarker"],
|
||||
"historyTimestamp": parXMLOut[0].attrib["historyTimestamp"]})
|
||||
eventsXMLOut = doXMLRequest(TARGET_IP, ET.tostring(eventsXMLIn))
|
||||
|
||||
for event in eventsXMLOut[0]:
|
||||
ET.dump(event)
|
||||
att = event.attrib
|
||||
eventType = int(att["eventType"])
|
||||
|
Reference in New Issue
Block a user