简体   繁体   中英

How to retrieve CouchDB replication status from Python

In bash I can retrieve a json blob of CouchDB replication status docs easily:

curl -X GET -u admin:password localhost:5984/_scheduler/docs/_replicator

Is it possible to retrieve the same information in Python using the couchdb library? I've tried this:

couch_db.view("_scheduler/docs/_replicator", include_docs=True)

.. but this returns a ('not_found', 'missing') error.

It turns out that I was making this more complicated than required. Using the Python requests library makes this task trivial:

requests.get("localhost:5984/_scheduler/docs/_replicator", auth=("admin", "password"))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM