Last active
August 29, 2015 14:08
-
-
Save marshyski/17da5ec375d3937c7375 to your computer and use it in GitHub Desktop.
marshyski.com health check
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/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