Tuesday, January 04, 2005

PyBlogger on Series 60

One of the things I've been wanting to do for a while was post directly to my blog from my Nokia 6600. With the arrival of Python for Series 60 this looked like it was going to be fairly easy to manage. The Blogger API is fairly trivial, but before reimplementing the wheel I thought I'd better look around and see if anyone had got there first with code that could be simply ported to the Series 60.

Mark Pilgrim's PyBlogger wrapper, which is now being maintained by Brent Loertscher, looked to be the thing to try and get working. In the end this proved to be pretty easy...

PyBlogger sits ontop of the XML-RPC Python Library (xmllibrpc.py) which isn't included with the Series 60 distribution. I downloaded this and pushed it onto my phone using Bluetooth, installing it as a library using the Python Installer along with the lower level xmllib.py which I grabbed from my laptop's Python 2.3 installation.

I then installed Mark's blogger.py library in a similar fashion, and fired up the bluetooth console on my Mac,
>>> import blogger
>>> username = "USERNAME"
>>> password = "PASSWORD"
>>> blogs = blogger.listBlogs(username, password)
>>> myBlog = blogs[0]
>>> print myBlog["url"]
Worked flawlessly. Can't really complain at that point. So I think my first project, just to get me used to the UI coding issues on the phone, will be a nice little app to let me blog directly from my phone. This is so much easier than Java ME...