Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
DevCenter
-
Hi @ole,
Please find below is the code to check online status for dev center written by @viticci. I am getting strange output! And please find the attached screenshots.
Note:-
I getting error on iOS 7 but not in iOS 6.from bs4 import BeautifulSoup import requests import console import sys import notification 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 runagain = notification.schedule('Checking Dev Center Status', 3600, 'default', 'pythonista://DevCenter?action=run')
Please help me to correct the problem...
-
I can't really reproduce the problem, but I guess it might have to do with surrounding whitespace in the parsed output. I'd recommend replacing line 23 with
print td.text.strip()
(to remove any leading/trailing whitespace from the text). -
@omz Thanks superb...