The Herd Of Kittens Python Development - Del.icio.us Proxy

Huh?

Del.icio.us is a clever collaborative keyword-categorized bookmark collection service. Instead of just stuffing a bookmark somewhere in a complex hierarchy of browser-bookmark-folders, never to be seen again, you toss the URL at del.icio.us, along with

This isn't about rigor - just about "what words come to mind", or even just "why you want to remember this". They go into a "personal" (but public) collection, which you can search and filter on; there are (of course) RSS feeds, so for example if you're collaborating with someone or even doing research for them, you can just have them subscribe to the relevant keyword. Many clever uses are possible.

As for the "public" component, suppose you go back to look at your links on robots and civil-liberties. You can then immediately widen to see more material by looking at what anyone else has put in those categories. This is the "payback" for making yours public too.

Ok, what do you mean by proxy?

In order to encourage clever applications, Del.icio.us has a simple API which lets you query it directly (not really REST, but cgi-style arguments and XML response payloads, very simple to talk to) without having to screen scrape the UI (and likely more efficient too.) One of the first applications is Cocoalicious, a Mac 3-pane browser for Del.icio.us (keywords on the left, urls for the selected keywords on top-right, browser bottom right.)

Given this narrower interaction channel, it seems straightforward to manipulate it. Some quality time with Python's BaseHTTPServer and urllib led to a proxy: you configure Cocoalicious to point to the proxy, which then forwards the request back up to the real server, and copies the responses back, "sniffing" them as they go.

So what good is it?

I have three applications in mind, now that I see how the protocol works.

  1. Offline mode. By sniffing the responses, it can keep a log of all of your bookmarks locally; then, if you can't reach del.icio.us itself but still want to look at some bookmarks (perhaps the extended description tells you enough; perhaps you have some distinct local proxy for offline document reading) the proxy can simply serve you the old answers. If for some reason you submit new documents, it can save those for later replay.
  2. "private" mode. (It does occur to me that this kind of "misses the point" of the public collaborative use of del.icio.us, but on the other hand, if I can use one common interface for all of my bookmarking, I'll probably contribute more than I would have otherwise.) This one is a slight variation on offline mode - it copies the queries through, but if it sees a "private" tag in the keyword list, it stashes the mark locally and does not push it upstream. Then, all requests for bookmarks get augmented with any matches from the local "private" set. (Bookmarking of "file:" URLs could also trigger this automatically, without the keyword.) Since cocoalicious already has "update info for this url" there's a builtin way to "promote" a URL from private to public - just delete the private tag, the resubmit will then go upstream.
  3. "action" mode. I currently use a "trackforward" tool to build an RSS feed of messages I've posted; I can instead use Cocoalicious to mark them, and then if there's a corresponding trackforward keyword, use that to trigger the feed update. This particular case can also be handled simply by using the personal-keyword-rss-feed feature of del.icio.us, so I may not get that far with it.

Ok, so where is it?

mini-deli.py is the latest CVS version, which is just a simple proxy that stashes the XML results in a lookaside directory - it doesn't do any of the three modes above, yet. It will soon.