Skip to content

Instantly share code, notes, and snippets.

Last active December 8, 2016 19:59
Show Gist options
  • Save nicolasH/6102105 to your computer and use it in GitHub Desktop.
Save nicolasH/6102105 to your computer and use it in GitHub Desktop.
apple system status
import sys
import console
import requests
from bs4 import BeautifulSoup
from datetime import datetime
# Check the status of the Apple Dev Center systems.
# Offline systems appear in orange
# Online systems appear in black
# Author: Nicolas HOIBIAN | @nico_h |
# License: Creative Common By-NC-SA
# @viticci on twitter created a version that uses the Pythonista notification module for timely reminders:
# url fetching activity indicator courtesy of @fcrespo82 on twitter
console.set_font("Futura", 16)
console.set_color(0, 0, 0)
print "Fetching DevCenter status"
print"%Y/%m/%d %H:%M:%S (local time)")
resp = requests.get(url)
html_doc = resp.text
soup = BeautifulSoup(html_doc)
down = 0
up = 0
# Data Last Updated on apple server
for h2 in soup.find_all("h2"):
print "Data Last", h2.text
print "_______________________"
for td in soup.find_all("td"):
if td["class"][0] == "offline":
console.set_color(1, 0.5, 0)
console.set_color(0, 0, 0)
print td.text
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
Copy link

ruurd commented Jul 29, 2013

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