Skip to main content

Couchbase BLIP Protocol Library

Project description

Python BLIP

Pure Python implementation of the Couchbase BLIP sync protocol.

Installing

python3 -m venv venv
. venv/bin/activate
pip3 install pythonblip

Usage

from pythonblip.headers import SessionAuth
from pythonblip.replicator import Replicator, ReplicatorConfiguration, ReplicatorType
from pythonblip.output import LocalDB, LocalFile, ScreenOutput

host = "127.0.0.1"
database = "mobile"
port = "4984"
ssl = True
directory = os.environ['HOME']
scope = "data"
collections = ["employees", "payroll"]

replicator = Replicator(ReplicatorConfiguration.create(
    database,
    host,
    ReplicatorType.PULL,
    SessionAuth(options.session),
    ssl,
    port,
    scope,
    collections,
    LocalFile(directory)
))

try:
    replicator.start()
    replicator.replicate()
    replicator.stop()
except Exception as err:
    print(f"Error: {err}")

Sync documents with 3.0 and earlier protocol (all documents in the _default scope and collection).

blipctl -n 127.0.0.1 -d database -t 9ec978de8f0fc172708cdbb9fc3f903a882883ec -f -D /home/sync/tests/output/ --ssl

Use new 3.1 and later style with scopes and collections.

blipctl -n 127.0.0.1 -d database -t 1eaccb9f9dc219a1b5d18e18e7f3d058efd1e9ff -s scope -c collection1,collection2,collection3 -f -D /home/sync/tests/output/ --ssl

Note: To get a session token you can use the SGWCLI:

./sgwcli auth session -h 127.0.0.1 -n database -U sgw@user --ssl

blipctl arguments:

Options Description
--ssl Use SSL
-n HOST, --host HOST Hostname or IP address
-P PORT, --port PORT Port number
-u USER, --user USER User Name
-p PASSWORD, --password PASSWORD User Password
-d DATABASE, --database DATABASE Sync Gateway Database
-t SESSION, --session SESSION Session Token
-O, --screen Output documents to the terminal
-f, --file Output documents to file(s)
-D DIR, --dir DIR Output Directory
-s SCOPE, --scope SCOPE Scope
-c COLLECTIONS, --collections COLLECTIONS Collections
-vv, --debug Debug output
-v, --verbose Verbose output

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythonblip-0.3.1.tar.gz (18.4 kB view details)

Uploaded Source

File details

Details for the file pythonblip-0.3.1.tar.gz.

File metadata

  • Download URL: pythonblip-0.3.1.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for pythonblip-0.3.1.tar.gz
Algorithm Hash digest
SHA256 29885a2b83c5b427fe410d9c623ff1ff51a400e49c7e7a6d7f245639984e0cc0
MD5 03f493c04cf3a9ceded259c6d196e683
BLAKE2b-256 337834251867969cf830fac8dbe0bbf10b2f40650aae618b02150f2c891ee0de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page