Skip to content

Instantly share code, notes, and snippets.

@managedkaos
Created July 31, 2017 19:37
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 managedkaos/3e4cfda45452682575c5b5d1fc3e186d to your computer and use it in GitHub Desktop.
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/
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)
@managedkaos
Copy link
Author

Output looks like:

12:35 $ python github_status.py
App Server Availability                  91.6955%
Mean Web Response Time                   250ms
Mean API Response Time                   56ms
98th Perc. Web Response Time             1099ms
Pages Builds Failure Rate                55.2964%
Exception Percentage                     0.0007%
Mean Hook Delivery Time                  0.26s
98th Perc. Browser Time to First Byte    0ms

@managedkaos
Copy link
Author

Github Status Page in HTML

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment