diff --git a/rebootasic b/rebootasic index 54105e9..17c9d6d 100755 --- a/rebootasic +++ b/rebootasic @@ -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" \ No newline at end of file + print "HOST is Down" +except (socket.timeout, socket.error, httplib2.HttpLib2Error, httplib.ResponseNotReady): + print "ERROR" \ No newline at end of file