Skip to content

Instantly share code, notes, and snippets.

@eduardkoller
Created October 1, 2013 20:22
Show Gist options
  • Save eduardkoller/6784503 to your computer and use it in GitHub Desktop.
Save eduardkoller/6784503 to your computer and use it in GitHub Desktop.
Checks the U.S. Government's Official Web Portal for the "Government Shutdown" message: "Due to a lapse in funding, the U.S. federal government has shut down"
#!/usr/bin/env python
#
# file: isgovtdown.py
#
# description: checks usa.gov for the "Government has shut down" message
#
# usage: ./isgovtdown.py
#
# or in a crontab:
# */5 * * * * /path/to/isgovtdown.py && mailx -s 5s [email protected]
#
import re, sys
from urllib.request import urlopen
page = urlopen("http://usa.gov").read()
if(re.search(b'Due to a lapse in funding, the U.S. federal government has shut down',page)):
print("Government still down")
sys.exit(1)
else:
print ("Government back up")
sys.exit(0)
@sidwarkd
Copy link

sidwarkd commented Oct 3, 2013

Finally got around to the hardware twist. My LCD was burned out so I just use a couple of LEDs for status instead. See my fork for details. Also modified to run on Python 2.7 as Dillie-O did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment