Commit e7f6a2a4 authored by kpetersn's avatar kpetersn
Browse files

Switched to using curl to grab the xml file. Python was having trouble when...

Switched to using curl to grab the xml file.  Python was having trouble when the script was run from the cron job.
parent 298016ab
...@@ -57,18 +57,26 @@ ioc_url = "http://bcda.xray.aps.anl.gov/cgi-bin/ioc_alive.cgi?ioc=" ...@@ -57,18 +57,26 @@ ioc_url = "http://bcda.xray.aps.anl.gov/cgi-bin/ioc_alive.cgi?ioc="
hb_period = 10 hb_period = 10
ioc_list = {} ioc_list = {}
# Use curl to get the xml file to avoid python problems from cron job
#!print "Curling URL"
command = "curl -s %s" % alive_url
p = os.popen(command, 'r')
xml_string = p.read()
p.close()
# Get the xml file # Get the xml file
#!print "Opening URL" #!print "Opening URL"
try: #!try:
f = urllib.urlopen(alive_url) #! f = urllib.urlopen(alive_url)
except IOError: #!except IOError:
print "Couldn't open URL" #! print "Couldn't open URL"
sys.exit(1) #! sys.exit(1)
#!print "Reading XML from URL" #!print "Reading XML from URL"
xml_string = f.read() #!xml_string = f.read()
#!print "Closing URL" #!print "Closing URL"
f.close() #!f.close()
# Parse the xml string # Parse the xml string
#!print "Parsing XML" #!print "Parsing XML"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment