views:

223

answers:

2

Having previously obtained a post ID from a call to gdata.blogger.client.add_post()...

post = client.add_post(...)
post_id = post.get_post_id()

...how do I use that post id to retrieve the post in the future? I thought maybe gdata.blogger.client.Query would be the way to go, but this doesn't support post id as a query term. The example code distributed with the Python gdata module doesn't have an example of this use case, and after poking around gdata.blogger.client.* for a while I'm not making much progress.

I could obviously iterate through all the posts in the blog until find the one with the corresponding id, but that would be a terrible, terrible idea.

+1  A: 

Continue my theme of answering my own questions...

After lots of fiddling, it looks like this is one solution. Given:

  • client -- a gdata.blogger.client.BloggerClient instance, and
  • blog -- a gdata.blogger.data.Blog instance
  • post_id -- a post id as returned by gdata.blogger.data.BlogPost.get_post_id

You can do this:

post = client.get_feed(
            blog.get_post_link().href + '/%s' % post_id,
            auth_token=client.auth_token,
            desired_class=gdata.blogger.data.BlogPost)
larsks
A: 

Are you able to get the list of blogs that the user is following (not the ones the user owns/authors)?

grmn.bob
(a) the api doesn't appear to provide access to the list of followed blogs, and (b) http://stackoverflow.com/questions/ask will probably get your question more exposure.
larsks
good point ... I took your advice and just now posted the question. however, I am losing hope for my answer to be positive.
grmn.bob