usr bin python262 import httplib def http_check ip conn httplib HTTPCo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python262
import httplib
def http_check(ip):
conn = httplib.HTTPConnection(ip,timeout=3)
try:
conn.request("GET", "/")
except:
print "Error occured"
conn.close()
return 0
r1 = conn.getresponse()
print r1.status, r1.reason
conn.close()
IPS=['xxx','yyy']
i=0
while i < len(IPS):
print "Checking :", IPS[i]
http_check(IPS[i])
i+=1