Instantly share code, notes, and snippets.

Embed
What would you like to do?
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 youremail@address.com
#
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

This comment has been minimized.

sidwarkd commented Oct 1, 2013

Love it. Now we just need to incorporate a little hardware. Maybe a Raspberry Pi with an LCD showing the message.

@Dillie-O

This comment has been minimized.

Dillie-O commented Oct 1, 2013

Nice! I did a quick fork and updated it to work with Python 2.7.... Yes, I'm out of date. 8^D

@sidwarkd

This comment has been minimized.

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