Fun with Tags

As I mentioned a few posts back, tags are a bit weird. I had assumed that you would be able to query for a list of posts belonging to a certain tag but apparently not.

What I have gone for instead is to scrape the rss feed for the tag, and from that grab the post ids.

As there could be hundreds the call returns post objects which behave like dicts but can retrieve the data from the server as it is accessed.

So to grab all the posts tagged ‘python’ and print the body text of the first post you can do this:

tagged_posts = blog["python"]

print tagged_posts[0]["body"]


Published: August 26 2011

  • category:
blog comments powered by Disqus