memberPlumbing/sendSchedule.py

27 lines
806 B
Python
Raw Normal View History

#!/usr/bin/env python3
2018-05-07 18:04:12 -04:00
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'<?xml version="1.0" encoding="UTF-8"?>' + ET.tostring(delXML))
doRequest(b'<?xml version="1.0" encoding="UTF-8"?>' + ET.tostring(delXML))
with open("schedules.xml", "rb") as f:
doRequest(f.read())