Created
July 31, 2017 19:37
-
-
Save managedkaos/3e4cfda45452682575c5b5d1fc3e186d to your computer and use it in GitHub Desktop.
A python script to scrape the status metrics from https://status.github.com/
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
import requests | |
from bs4 import BeautifulSoup | |
# make a request for the data | |
r = requests.get('https://status.github.com/') | |
# convert the response text to soup | |
soup = BeautifulSoup(r.text, "lxml") | |
# get all the divs with the "graph" class | |
for graph in soup.find_all("div", {"class":"graph"}): | |
# from the graph div, get all the divs with the "data" class | |
for data in graph("div", {"class":"data"}): | |
# from the data div, grab the h2 and span | |
h2 = data("h2")[0] | |
span = data("span")[0] | |
# print the report for this metric | |
print "%-40s %s" % (h2.string, span.string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like: