Created
October 1, 2013 20:22
-
-
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"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) | |
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
Nice! I did a quick fork and updated it to work with Python 2.7.... Yes, I'm out of date. 8^D