Retrieving Blogger posts by post id

Fri 29 January 2010 by Lars Kellogg-Stedman Tags python blogger api gdata

I spent some time recently trying to figure out, using Google's gdata API, how to retrieve a post from a Blogger blog if I know corresponding post id. As far as I can tell there is no obvious way of doing this, at least not using the gdata.blogger.client api, but after much nashing of teeth I came up with the following solution.

Given client, a gdata.blogger.client instance, and blog, a instance, the following code will return a instance:

post = client.get_feed(blog.get_post_link().href
          + '/%s' % post_id,

I'm not sure if this is the canonical solution or not, but it appears to work for me.