Archive for the ‘python’ Category
Was looking around the net for python scripts to work with SVG and I stumbled upon SVGDraw. Its a nice module if you are looking to output SVG, but even neater (I thought) was the xmlgen module to generate valid XML output for most standard XML languages (SVG, RSS etc) whose DTDs are available online. See the code to experience it first hand 🙂
Today I have added a new ‘photos page‘ to this blog for linking to my individual flickr photosets from here. But I do not want to keep updating this page manually every time I add a new set on flickr. Several developers have already written WordPress plugins to handle this issue so as to dynamically generate the flickr content on the server after querying the user’s flickr page. However, these solutions are not applicable to users of wordpress.com since we cannot run arbitrary plugins on the wordpress.com server with a free blog account.
In the absence of the server side solutions being applicable, I wondered if it would be possible to write a script to download flickr information using the flickr API and then update the blog page that I just set up using the WordPress API. If this worked out then I could potentially set up this script to run in a cron job and forget about updating this page manually. Turns out this is indeed possible using python and the associated API wrappers for Flickr and WordPress. The whole hack took me a couple of hours to get it working once I had located the API keys and appropriate python API wrappers. Its a bit rudimentary right now, but I plan to polish it a bit further to get better output and then I’ll post the script out here for others to refer, comment or use 🙂
Meanwhile if you just can’t wait, please drop me a note and I’ll send you a beta copy 😉