Last active
January 28, 2016 02:50
-
-
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)
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
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