Python Feedburner Awareness API Script


/ Published in: Python
Save to your folder(s)

prints out the RSS reach, circulation, and hits for a feedburner feed.


Copy this code and paste it in your HTML
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # (C) 2009 HalOtis Marketing
  4. # written by Matt Warren
  5. # http://halotis.com/
  6.  
  7. import urllib2
  8. try:
  9. from xml.etree import ElementTree
  10. except ImportError:
  11. from elementtree import ElementTree
  12.  
  13. #add a dates=YYYY-MM-DD,YYYY-MM-DD argument to the url to get all data in a date range
  14. url_prefix = 'https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri='
  15.  
  16. URIs = ['HalotisBlog',]
  17.  
  18. def print_feedburner(content):
  19. tree = ElementTree.fromstring(content)
  20. for feed in tree.findall('feed'):
  21. print feed.get('uri'), ':'
  22. for entry in feed.findall('entry'):
  23. print entry.get('date'), '-', entry.get('reach'), '-', entry.get('circulation'), '-', entry.get('hits')
  24.  
  25.  
  26. if __name__=='__main__':
  27.  
  28. for uri in URIs:
  29. content = urllib2.urlopen(url_prefix + uri).read()
  30. print_feedburner(content)

URL: http://www.halotis.com/2009/08/13/python-feedburner-awareness-api-script/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.