-
-
Save Dillie-O/6786397 to your computer and use it in GitHub Desktop.
Revised to work with Python 2.7
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 | |
# Forked from https://gist.github.com/eduardkoller/6784503 | |
# and modified to work with Python 2.7 | |
# | |
# usage: ./isgovtdown.py | |
# | |
# or in a crontab: | |
# */5 * * * * /path/to/isgovtdown.py && mailx -s 5s [email protected] | |
# | |
import re, sys, urllib | |
page = urllib.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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice, thanks for the fork