Eitol
3/17/2017 - 5:15 PM

View names of all Views CouchDB in Python

View names of all Views CouchDB in Python

_db = couchdb.Server("http://user:miclave_loca@192.168.1.250:5984/")['base_de_datos_loca']

def get_all_views(db: couchdb.Server) -> list:
    views_raw = _db.view('_all_docs', startkey="_design/", endkey="_design0", include_docs=True)
    return [view.id.split('/')[1] for view in views_raw.rows]
    return views

if __name__ == '__main__':
    print(get_all_views(_db))