I was bored, and I wanted to play with the API, so I came up with this little script:
It's coded in Python and has only a single image dependency.
Here is a screenshot:
Here's the source code (it's tiny, so I have no reason to host it on an external site):
import urllib, gzip, cStringIO, simplejson, pynotify, gtk
url = 'http://api.stackoverflow.com/1.0/users/464744' # I would change this, unless you want to monitor my account ;)
connection = urllib.urlopen(url)
response = connection.read()
connection.close()
info = simplejson.load(gzip.GzipFile(fileobj=cStringIO.StringIO(response)))['users'][0]
pynotify.init("PyOverflow")
message = pynotify.Notification("Stack Overflow", "Reputation: " + str(info['reputation']) + "\n" +
"Number of questions: " + str(info['question_count']) + "\n" +
"Number of answers: " + str(info['answer_count']) + "\n" +
"Number of up votes: " + str(info['up_vote_count']) + "\n" +
"Number of down votes: " + str(info['down_vote_count']) + "\n" +
"Accept rate: " + str(info['accept_rate']) + "%")
message.set_icon_from_pixbuf(gtk.gdk.pixbuf_new_from_file('icon.png'))
message.show()
And here's the image the script would be looking for:
As it took me a while to figure out the JSON and API part, I might make a Python API for this, just for fun.
Any suggestions are welcome (don't worry, I will make this thing a bit more versatile)!
icon_url
via stackauth.com/1.0/sites (though you should cache it).