Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@managedkaos managedkaos commented Jul 31, 2017

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

This comment has been minimized.

Copy link
Owner Author

@managedkaos managedkaos commented Jul 31, 2017

Github Status Page in HTML

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