Skip to content

Instantly share code, notes, and snippets.

@TRManderson TRManderson/check_gh.py
Last active Jan 28, 2016

Embed
What would you like to do?
Repeatedly hit the Github status API to see if it's down or not (py2/3 compatible and cross-platform)
from __future__ import print_function
import requests
import os
import time
if os.name == "posix":
def sound():
os.system("play --no-show-progress --null --channels 1 synth 5 sin 440")
else:
import winsound
def sound():
winsound.Beep(440, 5)
print("Is GitHub back yet?")
while True:
req = requests.get("https://status.github.com/api/status.json")
if req.json()["status"] != "major":
break
else:
print("Still down")
time.sleep(30)
print("We", req.json()["status"])
sound()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.