Skip to content

Instantly share code, notes, and snippets.

@TRManderson
Last active January 28, 2016 02:50
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 TRManderson/71d3ccba724a8266ffec to your computer and use it in GitHub Desktop.
Save TRManderson/71d3ccba724a8266ffec to your computer and use it in GitHub Desktop.
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