Skip to content

Instantly share code, notes, and snippets.

@eduardkoller
Created January 13, 2019 09:18
Show Gist options
  • Save eduardkoller/c161822d10dece9762e48f6d18b05d09 to your computer and use it in GitHub Desktop.
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
#!/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 youremail@address.com
#
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