A script to display a random goal from 43things.com in Ubuntu's Notify-OSD. Set it up to start on login and you'll get a new goal every day.
43_tips.py
#!/usr/bin/python -tt
# A script to display a random goal from 43things.com in Ubuntu's Notify-OSD. Set it up to start
# on login and you'll get a new goal every day.
# Author: A. Roots
import urllib, sys
from xml.dom import minidom
import random
import pynotify
def main():
print 'Fetching today's tip...'
random.seed()
randomNumber = random.randint(1,3000000)
url = 'http://www.43things.com/service/get_goal_by_id?api_key=2939451@43hKaaBzWkJ8&id='+str(randomNumber)
xmlFile = urllib.urlopen(url).read()
dom = minidom.parseString(xmlFile)
objektid = dom.getElementsByTagName('name')
objekt = objektid[0].toxml()
objekt = objekt[6:]
objekt = objekt[:-7]
n = pynotify.Notification ("You should...", str(objekt))
n.show ()
print 'All done, exiting.'
sys.exit(0)
if __name__ == '__main__':
main()
