From f3556f74a4613f0ae73c8cec06ab4e347f87ffd0 Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 11 May 2018 19:04:12 -0400 Subject: [PATCH] doorUpdater: Actually check for errors in response xml --- doorUpdater.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doorUpdater.py b/doorUpdater.py index b09f0c4..2f07082 100755 --- a/doorUpdater.py +++ b/doorUpdater.py @@ -5,6 +5,7 @@ import csv from io import StringIO import urllib3 from hashlib import md5 +from xml.etree import ElementTree as ET import os from passwords import * @@ -116,7 +117,9 @@ def doRequest(ip, params=None, files=None): auth=requests.auth.HTTPDigestAuth(DOOR_USERNAME, DOOR_PASSWORD), timeout=10, verify=False) # ignore insecure SSL - if r.status_code != 200: + xml = ET.XML(r.text) + if r.status_code != 200 \ + or len(xml.findall("{http://www.hidglobal.com/VertX}Error")) > 0: print("Door Updating Error: ", r.status_code, r.reason) print(r.text) sys.exit(1)