Skip to content

Instantly share code, notes, and snippets.

@nicolasH
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.

Revisions

  1. nicolasH revised this gist Aug 17, 2013. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions apple system status.py
    Original file line number Diff line number Diff line change
    @@ -3,16 +3,19 @@
    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 | www.niconomicon.net
    # License: Creative Common By-NC-SA
    #
    # @viticci created a version that uses the Pythonista notification module for timely reminders:
    # @viticci on twitter 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/
    #
    # url fetching activity indicator courtesy of @fcrespo82 on twitter
    #https://gist.github.com/fcrespo82/5b9b35bc8a0a62c7ec1a

    console.clear()
    console.set_font("Futura", 16)
  2. nicolasH revised this gist Aug 17, 2013. 1 changed file with 18 additions and 14 deletions.
    32 changes: 18 additions & 14 deletions apple system status.py
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,24 @@
    from bs4 import BeautifulSoup
    import requests
    import console
    import sys
    import notification
    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 | www.niconomicon.net
    # License: Creative Common By-NC-SA
    #
    # @viticci has a version that uses the notification module for timely reminders:
    # @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")
    print "_______________________"
    print datetime.now().strftime("%Y/%m/%d %H:%M:%S (local time)")
    url="https://developer.apple.com/support/system-status/"
    console.show_activity()
    resp = requests.get(url)
    @@ -29,14 +29,18 @@

    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)
    down+=1
    else:
    console.set_color(0, 0, 0)
    up+=1
    print td.text
    if td["class"][0] == "offline":
    console.set_color(1, 0.5, 0)
    down+=1
    else:
    console.set_color(0, 0, 0)
    up+=1
    print td.text

    console.set_color(0, 0, 0)
    print "_______________________"
  3. nicolasH revised this gist Aug 17, 2013. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions apple system status.py
    Original file line number Diff line number Diff line change
    @@ -14,11 +14,11 @@
    # http://www.macstories.net/linked/check-dev-center-status-from-ios-with-pythonista/

    console.clear()
    console.set_font('Futura', 16)
    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")
    print '_______________________'
    print "_______________________"
    url="https://developer.apple.com/support/system-status/"
    console.show_activity()
    resp = requests.get(url)
    @@ -29,8 +29,8 @@

    down = 0
    up = 0
    for td in soup.find_all('td'):
    if td['class'][0] == 'offline':
    for td in soup.find_all("td"):
    if td["class"][0] == "offline":
    console.set_color(1, 0.5, 0)
    down+=1
    else:
    @@ -39,8 +39,8 @@
    print td.text

    console.set_color(0, 0, 0)
    print '_______________________'
    print "_______________________"
    console.set_color(1, 0.5, 0)
    print 'Offline:',down
    print "Offline:", down
    console.set_color(0, 0, 0)
    print 'Online:',up
    print "Online:", up
  4. nicolasH revised this gist Aug 17, 2013. 1 changed file with 26 additions and 9 deletions.
    35 changes: 26 additions & 9 deletions apple system status.py
    Original file line number Diff line number Diff line change
    @@ -2,24 +2,41 @@
    import requests
    import console
    import sys
    import notification
    from datetime import datetime

    # Check the status of the Apple Dev Center systems.
    #
    # Author: Nicolas HOIBIAN | @nico_h | www.niconomicon.net
    # License: Creative Common By-NC-SA
    #
    # @viticci has a version that uses the 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")
    print '_______________________'
    url="https://developer.apple.com/support/system-status/"
    console.show_activity()
    resp = requests.get(url)
    console.hide_activity()

    html_doc = resp.text
    soup = BeautifulSoup(html_doc)
    console.clear()
    console.set_font('Futura', 16)

    down = 0
    up = 0
    for td in soup.find_all('td'):
    if td['class'][0] == 'offline':
    console.set_color(1, 0.5, 0)
    down+=1
    else:
    console.set_color(0, 0, 0)
    up+=1
    print td.text
    if td['class'][0] == 'offline':
    console.set_color(1, 0.5, 0)
    down+=1
    else:
    console.set_color(0, 0, 0)
    up+=1
    print td.text

    console.set_color(0, 0, 0)
    print '_______________________'
  5. nicolasH created this gist Jul 29, 2013.
    29 changes: 29 additions & 0 deletions apple system status.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    from bs4 import BeautifulSoup
    import requests
    import console
    import sys

    url="https://developer.apple.com/support/system-status/"
    resp = requests.get(url)

    html_doc = resp.text
    soup = BeautifulSoup(html_doc)
    console.clear()
    console.set_font('Futura', 16)
    down = 0
    up = 0
    for td in soup.find_all('td'):
    if td['class'][0] == 'offline':
    console.set_color(1, 0.5, 0)
    down+=1
    else:
    console.set_color(0, 0, 0)
    up+=1
    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