What a n00b!

Know Your Library, Yo

You can definitely file this one under "what a n00b!".

First, a little backstory. When we started out creating the Flickr integration for ShutterGuides, we used what seemed to be the most mature and stable Python Flickr API binding out there, flickrapi. The only drawback with this library is that it doesn't support oauth. It seemed to be the most solid and well-documented that we found, so we went ahead anyway. In the meantime, Flickr announced that they were end-of-life-ing their old auth mechanism in favor of oauth at the end of July this year. Great. (I found a blog post at one point promising oauth, but can't seem to find it now.) Anyway, we decided that instead of adding oauth support to the library, to just migrate to a new library, we chose this one.

All right, with that out of the way, let's get to the point.

One of the swanky things about this new library is that it transparently retrieves information about Photo objects that aren't necessarily returned by Flickr by default. One of the bad things about this new library is that it transparently retrieves information about Photo objects that aren't necessarily returned by Flickr by default.

When I first developed the integration, I noticed it was a bit slower than the old one. I thought maybe I could chalk this up to extra latency from my home network to Flickr vs. our cloud provider to Flickr. However, once we got things into production, and got a real user to use it with a good amount of photos, the thing slowed to a crawl. Like, 20+s for a web request. Doh. As it turns out our call to flickr.Photosets.getPhotos (retrieve photos in a Flickr album) was not returning some of the data that we expected to be in the Photo object, and the library was graciously making an API call per photo to Flickr during our web request! (sorry about that, Flickr) The fix was trivial, we just needed to add the fields we use to the "extras" option during the original call, I just needed to notice that it was happening.

Like I said, put this one under "what a n00b!". I knew better and yet it happened anyway. Let this be a reminder to everyone to check out that new code you just integrated into your app. I will leave you with a warning that you should take just as seriously.

Comments

Comments powered by Disqus