Thursday 11 December 2008

snaptrip: talking to Flickr with GAE

For snaptrip, and probably for any future Flickr projects I do on Google App Engine, I use Beej's Flickr API module. As I've said before, I like libraries that use the strengths of dynamic languages. Rather than implementing every API call as a method, it's far better to use Flickr's own reflection methods to build checking, and a generic call handler to return JSON data. On the other hand, you do want something to handle all the authentication signing.

However, there's a small catch: the default build doesn't work on App Engine, because of the unique way that the BBC is funded fact that GAE doesn't support Python's core urllib/urllib2 libaries. Instead, it uses special methods like urlfetch to, well, fetch URLs. For some libraries (like the excellent Universal Feed Parser), you can work around this by fetching the content yourself and then passing it in to the library.

Unfortunately, that's not really a workable approach here: the entire point of a Flickr API library is that it handles talking to Flickr for you. So I delved in to the code and have produced an ugly, but working, patch against the last SourceForge version. It's a little ugly, and out of date, but it works for me, and if you need to talk to Flickr with Google App Engine, hopefully it'll work for you, too.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

About snaptrip news

snaptrip is a website that takes Dopplr and Flickr, puts them together, shakes them up, and sees what interesting things fall out.

This site lets you know what's new there.

Subscribe to Posts [Atom]