Created
January 13, 2019 09:18
-
-
Save eduardkoller/c161822d10dece9762e48f6d18b05d09 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 USA.gov website will be available, but not updated
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: isgovdown.py | |
# | |
# description: checks usa.gov for the "the USA.gov website will be available, but not updated" message | |
# | |
# usage: ./isgovdown.py | |
# | |
# or in a crontab: | |
# */5 * * * * /path/to/isgovdown.py && mailx -s 5s [email protected] | |
# | |
import re, sys | |
from urllib import urlopen | |
page = urlopen("http://usa.gov").read() | |
if(re.search(b'Due to a lapse in funding, the USA.gov website will be available, but not updated',page)): | |
print("Government still down") | |
sys.exit(1) | |
else: | |
print ("Government back up") | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment