I am using Cloudant for storing json-objects. They have an API for getting a continous feed with changes happening in the database. What I want to do is create a persistent connection towards this endpoint and call a function (callback) every time this response object gets updated. Cloudant has a built in function for this in Node-js, but nothing that can work in the background for python (using v 2.7).
How can I solve this? Haven't found anything useful online. The built-in functions in the Cloudant package doesn't work in the Flask API application that I have (they are just using never ending loops for retrieving the changes).
My idea is for the code to look something like this:
def callBack(event):
print(event)
session(url="username:password.cloudant.com/test/_changes?feed=continous", callback=callBack, feed="live")