Last active
August 29, 2015 14:05
-
-
Save ckarrie/775ab758b4d7f1a95a7c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xml.dom.minidom import parse | |
import urllib | |
IP = "192.168.178.45" | |
XML_FILE = "status.xml" | |
DI1_ELEMENT = "DigitalInput1" | |
OPEN = "OPEN" | |
CLOSED = "CLOSED" | |
xmlpath = "http://" + IP + "/" + XML_FILE | |
try: | |
xml = urllib.urlopen(xmlpath) | |
dom = parse(xml) | |
except Exeption as e: | |
print(e) | |
di = dom.getElementsByTagName(DI1_ELEMENT)[0] | |
v = di.firstChild.nodeValue | |
if v == CLOSED: | |
print "DI1 Closed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment