From b25deb66306c9d41ff251e22653a5e3416408855 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Mon, 7 May 2018 18:04:12 -0400 Subject: [PATCH] Add schedule pusher --- schedules.xml | 65 +++++++++++++++++++++++++++++++++++++++++++++++++ sendSchedule.py | 25 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 schedules.xml create mode 100644 sendSchedule.py diff --git a/schedules.xml b/schedules.xml new file mode 100644 index 0000000..0d9f3e3 --- /dev/null +++ b/schedules.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sendSchedule.py b/sendSchedule.py new file mode 100644 index 0000000..57d0050 --- /dev/null +++ b/sendSchedule.py @@ -0,0 +1,25 @@ +import requests +from xml.etree import ElementTree as ET +import urllib3 + +from passwords import * + +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) + +def doRequest(xml): + r = requests.get( + 'https://172.18.51.15/cgi-bin/vertx_xml.cgi', + params={'XML': xml}, + auth=requests.auth.HTTPDigestAuth(DOOR_USERNAME, DOOR_PASSWORD), + verify=False) + print(r.text) + +delXML = ET.Element("VertXMessage") +for ii in range(1, 8): + ET.SubElement(delXML, "hid:Schedules", + attrib={"action": "DD", "scheduleID": str(ii)}) +print(b'' + ET.tostring(delXML)) +doRequest(b'' + ET.tostring(delXML)) + +with open("schedules.xml", "rb") as f: + doRequest(f.read())