CodyKochmann
7/29/2016 - 2:41 PM

create a replication link in couchdb with python

create a replication link in couchdb with python

def replicate_remote_database(username,password,target_ip,db_name):
    import couchdb
    server = couchdb.Server() # connects to the local_server
    server.replicate(
        'http://{}:{}@{}:5984/{}'.format(
            username,
            password,
            target_ip,
            db_name
        ), 
        'http://{}:{}@127.0.0.1:5984/{}'.format(
            username,
            password,
            db_name
        ), 
        continuous=True
    )