pythonblip


Namepythonblip JSON
Version 0.3.1 PyPI version JSON
download
home_pagehttps://github.com/mminichino/python-blip
SummaryCouchbase BLIP Protocol Library
upload_time2023-06-16 15:36:47
maintainer
docs_urlNone
authorMichael Minichino
requires_python>=3.9
licenseApache License 2.0
keywords couchbase blip mobile syncgateway
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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](https://github.com/mminichino/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                   | 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mminichino/python-blip",
    "name": "pythonblip",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "couchbase,blip,mobile,syncgateway",
    "author": "Michael Minichino",
    "author_email": "info@unix.us.com",
    "download_url": "https://files.pythonhosted.org/packages/33/78/34251867969cf830fac8dbe0bbf10b2f40650aae618b02150f2c891ee0de/pythonblip-0.3.1.tar.gz",
    "platform": null,
    "description": "Python BLIP\n===========\nPure Python implementation of the Couchbase BLIP sync protocol.\n\nInstalling\n==========\n```\npython3 -m venv venv\n```\n```\n. venv/bin/activate\n```\n```\npip3 install pythonblip\n```\n\nUsage\n=====\n```\nfrom pythonblip.headers import SessionAuth\nfrom pythonblip.replicator import Replicator, ReplicatorConfiguration, ReplicatorType\nfrom pythonblip.output import LocalDB, LocalFile, ScreenOutput\n\nhost = \"127.0.0.1\"\ndatabase = \"mobile\"\nport = \"4984\"\nssl = True\ndirectory = os.environ['HOME']\nscope = \"data\"\ncollections = [\"employees\", \"payroll\"]\n\nreplicator = Replicator(ReplicatorConfiguration.create(\n    database,\n    host,\n    ReplicatorType.PULL,\n    SessionAuth(options.session),\n    ssl,\n    port,\n    scope,\n    collections,\n    LocalFile(directory)\n))\n\ntry:\n    replicator.start()\n    replicator.replicate()\n    replicator.stop()\nexcept Exception as err:\n    print(f\"Error: {err}\")\n```\n\nSync documents with 3.0 and earlier protocol (all documents in the _default scope and collection).\n```\nblipctl -n 127.0.0.1 -d database -t 9ec978de8f0fc172708cdbb9fc3f903a882883ec -f -D /home/sync/tests/output/ --ssl\n```\n\nUse new 3.1 and later style with scopes and collections.\n```\nblipctl -n 127.0.0.1 -d database -t 1eaccb9f9dc219a1b5d18e18e7f3d058efd1e9ff -s scope -c collection1,collection2,collection3 -f -D /home/sync/tests/output/ --ssl\n```\n\nNote: To get a session token you can use the [SGWCLI](https://github.com/mminichino/sgwcli):\n```\n./sgwcli auth session -h 127.0.0.1 -n database -U sgw@user --ssl\n```\n\n```blipctl``` arguments:\n\n| Options                                   | Description                      |\n|-------------------------------------------|----------------------------------|\n| --ssl                                     | Use SSL                          |\n| -n HOST, --host HOST                      | Hostname or IP address           |\n| -P PORT, --port PORT                      | Port number                      |\n| -u USER, --user USER                      | User Name                        |\n| -p PASSWORD, --password PASSWORD          | User Password                    |\n| -d DATABASE, --database DATABASE          | Sync Gateway Database            |\n| -t SESSION, --session SESSION             | Session Token                    |\n| -O, --screen                              | Output documents to the terminal |\n| -f, --file                                | Output documents to file(s)      |\n| -D DIR, --dir DIR                         | Output Directory                 |\n| -s SCOPE, --scope SCOPE                   | Scope                            |\n| -c COLLECTIONS, --collections COLLECTIONS | Collections                      |\n| -vv, --debug                              | Debug output                     | \n| -v, --verbose                             | Verbose output                   | \n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Couchbase BLIP Protocol Library",
    "version": "0.3.1",
    "project_urls": {
        "Homepage": "https://github.com/mminichino/python-blip"
    },
    "split_keywords": [
        "couchbase",
        "blip",
        "mobile",
        "syncgateway"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "337834251867969cf830fac8dbe0bbf10b2f40650aae618b02150f2c891ee0de",
                "md5": "03f493c04cf3a9ceded259c6d196e683",
                "sha256": "29885a2b83c5b427fe410d9c623ff1ff51a400e49c7e7a6d7f245639984e0cc0"
            },
            "downloads": -1,
            "filename": "pythonblip-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "03f493c04cf3a9ceded259c6d196e683",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 18439,
            "upload_time": "2023-06-16T15:36:47",
            "upload_time_iso_8601": "2023-06-16T15:36:47.692640Z",
            "url": "https://files.pythonhosted.org/packages/33/78/34251867969cf830fac8dbe0bbf10b2f40650aae618b02150f2c891ee0de/pythonblip-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-16 15:36:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mminichino",
    "github_project": "python-blip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pythonblip"
}
        
Elapsed time: 0.11216s