exception added
This commit is contained in:
+5
-2
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import httplib2
|
||||
import socket, httplib, httplib2
|
||||
import sys
|
||||
|
||||
URL = "http://"+sys.argv[1]+"/cgi-bin/reboot.cgi"
|
||||
@@ -10,6 +10,7 @@ PASS = sys.argv[3]
|
||||
h = httplib2.Http(cache=None, timeout=0.2)
|
||||
h.add_credentials(USER, PASS)
|
||||
|
||||
|
||||
try:
|
||||
response, content = h.request(URL, "GET", headers={'cache-control':'no-cache'})
|
||||
if response.status==401:
|
||||
@@ -17,4 +18,6 @@ try:
|
||||
elif response.status==404:
|
||||
print "Wrong Request Address"
|
||||
except httplib2.ServerNotFoundError:
|
||||
print "HOST is Down"
|
||||
print "HOST is Down"
|
||||
except (socket.timeout, socket.error, httplib2.HttpLib2Error, httplib.ResponseNotReady):
|
||||
print "ERROR"
|
||||
Reference in New Issue
Block a user