histrio/py-couchdb

polling for notifications

dedalus2000 opened this issue · 2 comments

This is an enhance request

It should be great to have the ability to check for updates

http://guide.couchdb.org/draft/notifications.html

With curl the command is:
curl -X GET "http://localhost:5984/db/_changes?feed=continuous&since=1"

With requests:
r= requests.get("http://localhost:5984/db/_changes", params={"feed":"continuous", "since":1}, stream=True)
for ch in r.iter_lines(chunk_size=1): print ch # ch is a str

I don't like chunk_size=1, but I don't know which could be the right size. 512 is too high. The result "ch" have to be jsonized

With couchdb-python this is the solution:
http://stackoverflow.com/questions/7840383/couchdb-python-change-notifications

Note that couchdb-python is able to check the single changes for each item; I don't know if this is a couchdb or a couchdb-python property

You are right. I go to implement it in few days or hours (depends on my time).
Thanks for the suggestion.

Now implemented 771f7ba

;)