philwilson.org

a geek commodity

Storing feedparser objects in couchdb

March 31st, 2009 by Phil

sudo apt-get install python-feedparser
easy_install jsonpickle
sudo apt-get install couchdb
easy_install couchdb
sudo couchdb

Open a new terminal

python
import feedparser, jsonpickle
from couchdb import Server
s = Server('http://127.0.0.1:5984/')
len(s)
db = s.create('feeds')
len(s)
doc = feedparser.parse("http://feedparser.org/docs/examples/atom10.xml")
doc['feed']['title']
len(doc.feed.links)
pfeed = jsonpickle.encode(doc)
db.create({'feed1' : pfeed})

outputs DOC_ID

cfeed = db['DOC_ID_HERE']
dfeed = jsonpickle.decode(cfeed['feed1'])
dfeed['feed']['title']
len(dfeed.feed.links)

Tagged: , , | 1 Comment »

One Response

  1. [...] Storing feedparser objects in couchdb [...]

    Posted by philwilson.org » Blog Archive » CouchDB in desktop applications on April 4th, 2009 at 5:10 pm

Leave a Comment




Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.