Tuesday, February 03, 2009

Backup Blogger Blog with Ruby Mechanize Script

After writing up a cURL script to download a backup of my Blogger blog in my previous post I started wondering what the best way to do this in Ruby would be. I looked at some Ruby HTTP clients and narrowed my choices down to two: Mechanize and HTTPClient. Both of these tools look pretty good but Mechanize seemed to offer a very simple interface to scripting a web interaction like this while HTTPClient would offer something that was more like my original cURL script. So I decided to write the same code with a Mechanize approach:

I need to beef this up with some error handling obviously - but I think you'll find Mechanize to be pretty slick if you try it.

1 comment:

  1. Isn't this the same David Burger who says error handling is overrated?


    Oh wait, no, that was me...