def setup_signs(api): result = urllib.urlopen("http://signs.hackerdojo.com"+api) rawdata = result.read() result.close() signs = json.loads(rawdata) for s in signs: msg = s['message'] lines = msg.split("\r\n") if len(lines)==2: sign.twoLines(s['two_digit_id'], lines[0], lines[1]) if len(lines)==1: sign.oneLine(s['two_digit_id'], lines[0])
#!/usr/local/bin/python # Pledgie import urllib2 import json import sign import locale usock = urllib2.urlopen("http://pledgie.com/campaigns/10602.json") data = usock.read() usock.close() pledgie = json.loads(data) amount = pledgie['campaign']['amount_raised'] pledges = pledgie['campaign']['pledges_count'] percent = pledgie['campaign']['percent_towards_goal'] pledge_guy = pledgie['campaign']['pledges'][-1]['display_name'] locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' ) parsedAmount = str(locale.currency(amount,grouping=True))[:-3] sign.twoLines("96", "Last donation:", str(pledge_guy)) sign.oneLine("97", parsedAmount) sign.twoLines("98", " %.1f%%" % percent + " of $35,000", "THANK YOU! If you can, please donate at hackerdojo.com to help us get heat & air conditioning!")
#!/usr/local/bin/python # Example import sign sign.oneLine("50", "Welcome") sign.twoLines("55", "Welcome to", "Hacker Dojo") sign.twoLines("54", "Please Sign In", "Enjoy Your Stay!")