This repository has been archived on 2024-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
memberPlumbing/sendSchedule.py

29 lines
682 B
Python
Executable File

#!/usr/bin/env python3
import requests
from xml.etree import ElementTree as ET
import csv
from io import StringIO
from common import *
TARGET_IP = '172.18.51.15'
# clear all people
outString = StringIO()
writer = csv.DictWriter(outString, fieldnames)
writer.writeheader()
writer.writerow({})
outString.seek(0)
doCSVImport(TARGET_IP, outString)
# clear all schedules
delXML = ET.Element("VertXMessage")
for ii in range(1, 8):
ET.SubElement(delXML, "hid:Schedules",
attrib={"action": "DD", "scheduleID": str(ii)})
doXMLRequest(TARGET_IP, ET.tostring(delXML))
# load new schedules
with open("schedules.xml", "rb") as f:
doXMLRequest(TARGET_IP, f.read())