Anonymous
public text v1 · immutableif not testUri(ea.as['web url']): ea.as['web url']='Not provisioned.'
def testUri(uri, port=80, resource="/"):
"""
tests urls for availability
"""
uri = str(uri)
try:
conn = httplib.HTTPConnection(uri)
conn.request("GET", resource)
rr = conn.getresponse()
print rr.status
except socket.error, msg:
ret = False
print "ret is false: " + uri
else:
ret = rr.status
print "ret is true: " + uri
conn.close()
return ret