Skip to content

Instantly share code, notes, and snippets.

@eduardkoller
Created October 1, 2013 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • 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 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
Copy link

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
Copy link

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
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