Python Feedburner Awareness API Script

feedburnerI spent some time trying to find a snippet of example code that used Feedburner’s Awareness API with Python but I Google wasn’t much help. So I put one together for you.

One thing that I didn’t realize about feedburner stats is that if the feed publicly displays a chicklet on the site (like mine) then the RSS data is available without authentication. Therefore it’s possible to display a history of other sites RSS statistics on your own. Maybe you can think of a way to use that data.

By adding a dates argument to the REST URL you can request historical data from the API but as the script is written it will just print out the current statistics.

Example Usage:

$ python feedburnerPrint.py
HalotisBlog :
2009-08-11 - 32 - 87 - 217

Here’s the Python source code:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (C) 2009 HalOtis Marketing
# written by Matt Warren
# http://halotis.com/
 
import urllib2
try:
    from xml.etree import ElementTree
except ImportError:
    from elementtree import ElementTree
 
#add a dates=YYYY-MM-DD,YYYY-MM-DD argument to the url to get all data in a date range
url_prefix = 'https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri='
 
URIs = ['HalotisBlog',]
 
def print_feedburner(content):
    tree = ElementTree.fromstring(content)
    for feed in tree.findall('feed'):
        print feed.get('uri'), ':'
        for entry in feed.findall('entry'):
            print entry.get('date'), '-', entry.get('reach'), '-', entry.get('circulation'), '-', entry.get('hits')
 
 
if  __name__=='__main__':
 
    for uri in URIs:
        content = urllib2.urlopen(url_prefix + uri).read()
        print_feedburner(content)
Bookmark and Share

Related posts:

  1. SEOCheck: Track Your Google Position Over Time
  2. Finding inlink information from Yahoo! in Python
  3. Find Links on Del.icio.us with a Python Script
  4. Scrape Advertisements from Google Search Results with Python
  5. Sending Email from Python using Gmail
Stumble it!


RSS feed | Trackback URI

3 Comments »

Comment by welch allyn
2009-08-13 09:56:04

thanks for the code!

 
Comment by halotis
2009-08-19 19:53:20

Python Feedburner Awareness API Script – I spent some time trying to find a snippet of example code that used Feedb.. http://bit.ly/qhC7Y

This comment was originally posted on Twitter

 
Comment by halotis
2009-08-29 10:01:10

Python Feedburner Awareness API Script – I spent some time trying to find a snippet of example code that used Feedb.. http://bit.ly/DCeCU

This comment was originally posted on Twitter

 
Name (required)
E-mail (required - never shown publicly)
URI
Subscribe to comments via email
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped=""> in your comment.

Additional comments powered by BackType