Skip to content

Instantly share code, notes, and snippets.

@nicolasH
Created July 24, 2014 22:36
Show Gist options
  • Save nicolasH/837ed329f590ce6b4342 to your computer and use it in GitHub Desktop.
Save nicolasH/837ed329f590ce6b4342 to your computer and use it in GitHub Desktop.
DevCenter.py
import sys
import console
import requests
from datetime import datetime
import json
# Check the status of the Apple Dev Center systems.
# version 2.0
#
# published information has changed from "web page to parse" to "semi-json file to process"
#
# Systems with informations about them appear in orange
# Systems with no details about them appear in black
#
# Author: Nicolas HOIBIAN | @nico_h | www.niconomicon.net
# License: Creative Common By-NC-SA
#
# Previous version:
# @viticci created a version that uses the Pythonista notification module for timely reminders:
# http://www.macstories.net/linked/check-dev-center-status-from-ios-with-pythonista/
console.clear()
console.set_font("Futura", 16)
console.set_color(0, 0, 0)
print "Fetching DevCenter status"
print datetime.now().strftime("%Y/%m/%d %H:%M:%S (local time)")
url="https://www.apple.com/support/systemstatus/data/developer/system_status_en_US.js"
console.show_activity()
resp = requests.get(url)
console.hide_activity()
json_doc = resp.text
json_doc=json_doc.replace("jsonCallback(","[")[:-2]+"]"
services = json.loads(json_doc)[0]['dashboard']['Services']
down = 0
up = 0
print "_______________________"
for key in sorted(services.keys()):
if len(services[key])>0:
console.set_color(1, 0.5, 0)
down += 1
else:
console.set_color(0, 0, 0)
up+=1
print key
console.set_color(0, 0, 0)
print "_______________________"
console.set_color(1, 0.5, 0)
print "Offline:", down
console.set_color(0, 0, 0)
print "Online:", up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment