That can’t be happening

I’m writing a neat program which uses the flickr.com web services API. At first, I tried the python bindings but then I got frustrated with them. Python, whilst a pretty decent dynamically-typed language, feels like smalltalk without any of the good tools. So, since I’m writing this program for my own use, I ditched python and started using Squeak instead. Woo, squeak is so much more fun!

However, I got stuck the other day when I tried using some of the flickr methods, like setTags(), which require you to use HTTP POST and provide username/password to prove that you are allowed to change tags. I would send off the request, and flickr would send me back an XML response saying “user not logged in”. I checked and double checked the request I was sending, but it still didn’t work. I found tcpmon which is a lightweight tool which makes it easy to trace the requests. Everything looked okay, but I still got an error back. In the end, I felt like I was banging my head against a brick wall. I couldn’t debug beyond the API boundary to find out what flickr.com thought was happening. I decided to give up for the day, and saved the squeak image to preserve the state.

Today, I fired up the image, reran the same code I tried yesterday. It worked first time. The setTags call succeeded.

Hang on. This is exactly the same world-state which I left yesterday, courtesy of smalltalk’s use of images. Nothing has changed. But suddenly it works.

I’ve no idea why it didn’t work before, or why it suddenly started working. Maybe flickr.com changed something on their site? Regardless, it’s been an interesting lesson on how to debug problems when calling webservices, and an example of the potential for frustration when an API doesn’t work like you’re expecting, and there’s not enough information to understand why.

3 thoughts on “That can’t be happening”

  1. That is so weird. I find it quite unsettling. I have quite often thought “this can’t be happening” when programming, and in the end I’ve always discovered some incorrect assumption that I made, or found that I was measuring the wrong thing etc. But in this case I really have no idea what happened. I’m encouraged that it wasn’t just me! But still, very strange …

  2. Any chance of you recording your Squeak sessions? I’m about to embark on some more Squeaking, and just know I’m going to do the slowest thing possible. I remember seeing something about shared Squeak sessions, but I can’t seem to get to squeak.org at the min. Hmm.

Comments are closed.