My business DSL connection was out this evening, so I wrote up a quick script to track how long exactly it was out for.
import envoy
import time
roller = 0
Limit = 50
while Limit > 0:
rs = envoy.run("ping google.com")
if rs.status_code != 1:
print "PING %s" % time.ctime()
Limit -= 1
time.sleep(10)
roller += 1
if roller % 100:
print "PONG %s" % time.ctime()
Envoy is probably one of my favorite utility libraries after the Http Request library. Github repo is here https://github.com/kennethreitz/envoy/blob/master/README.rst