Skip to content

Instantly share code, notes, and snippets.

@marshyski
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshyski/17da5ec375d3937c7375 to your computer and use it in GitHub Desktop.
Save marshyski/17da5ec375d3937c7375 to your computer and use it in GitHub Desktop.
marshyski.com health check
#!/usr/bin/python
import requests
from bs4 import BeautifulSoup
requests.packages.urllib3.disable_warnings()
urls = [
'http://marshyski.com/',
'http://marshyski.com/man-behind-the-keyboard/',
'http://marshyski.com/music/',
'http://marshyski.com/records/',
'http://marshyski.com/play/',
]
for URL in urls:
try:
r = requests.get(URL)
soup = BeautifulSoup(r.text)
if r.status_code == 200:
print URL, r.status_code, soup.title.string, "[OK]"
else:
print URL, r.status_code, "[FAIL]"
except:
print URL, r.status_code, "[FAIL]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment