cloudsync


Namecloudsync JSON
Version 2.4.7 PyPI version JSON
download
home_pagehttps://github.com/atakamallc/cloudsync
Summarycloudsync enables simple cloud file-level sync with a variety of cloud providers
upload_time2021-01-13 19:39:01
maintainer
docs_urlNone
authorAtakama, LLC
requires_python>=3.6
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.com/AtakamaLLC/cloudsync.svg?branch=master&token=WD7aozR2wQ3ePGe1QpA8)](https://travis-ci.com/AtakamaLLC/cloudsync)
[![Code Coverage](https://codecov.io/gh/AtakamaLLC/cloudsync/branch/master/graph/badge.svg)](https://codecov.io/gh/AtakamaLLC/cloudsync)

# cloudsync README

Python Cloud Synchronization Library

## Installation

```bash
pip install cloudsync

# install provider support
pip install cloudsync-gdrive
```

## Links

*   [Documentation](https://atakama-llc-cloudsync.readthedocs-hosted.com/en/latest/)
*   [Source Code + Issue Tracker](https://github.com/AtakamaLLC/cloudsync)

## Command-line Example

```bash

cloudsync sync --help

cloudsync sync file:c:/users/me/documents gdrive:/mydocs

# on linux you can pass -D for 'daemon mode', which will detatch and run in the background
```
## Example of a single cloud provider integration

```python
import cloudsync

# Get a generic client_id and client_secret. Do not use this in production code.
# For more information on getting your own client_id and client_secret, see README_OAUTH.md
oauth_config = cloudsync.command.utils.generic_oauth_config('gdrive')

# get an instance of the gdrive provider class
provider = cloudsync.create_provider('gdrive', oauth_config=oauth_config)

# Start the oauth process to login in to the cloud provider
creds = provider.authenticate()

# Use the credentials to connect to the cloud provider
provider.connect(creds)

# Perform cloud operations
for entry in provider.listdir_path("/"):
    print(entry.path)
```
## Example of a syncronization between two cloud providers

```python
import cloudsync
import tempfile
import time

# a little setup
local_root = tempfile.mkdtemp()
remote_root = "/cloudsync_test/" + time.strftime("%Y%m%d%H%M")
provider_name = 'gdrive'
print("syncronizing between %s locally and %s on %s" % (local_root, remote_root, provider_name))

# Get a generic client_id and client_secret. Do not use this in production code.
# For more information on getting your own client_id and client_secret, see README_OAUTH.md
cloud_oauth_config = cloudsync.command.utils.generic_oauth_config(provider_name)

# get instances of the local file provider and cloud provider from the provider factory
local = cloudsync.create_provider("filesystem")
remote = cloudsync.create_provider(provider_name, oauth_config=cloud_oauth_config)

# Authenticate with the remote provider using OAuth
creds = remote.authenticate()

# Connect with the credentials acquired by authenticating with the provider
local.namespace = local_root  # filesystem provider wants to know the root namespace before connecting
local.connect(None)
remote.connect(creds)

# Create the folder on google drive to syncronize locally
print("Creating folder %s on %s" % (remote_root, provider_name))
remote.mkdirs(remote_root)  # provider.mkdirs() will automatically create any necessary parent folders

# Specify which folders to syncronize
sync_roots = (local_root, remote_root)

# instantiate a new sync engine and start syncing
sync = cloudsync.CloudSync((local, remote), roots=sync_roots)
sync.start()

# should sync this file as soon as it's noticed by watchdog
local_hello_path = local.join(local_root, "hello.txt")
print("Creating local file %s" % local_hello_path)
with open(local_hello_path, "w") as f:
    f.write("hello")

# note remote.join, NOT os.path.join... Gets the path separator correct
remote_hello_path = remote.join(remote_root, "hello.txt")

# wait for sync to upload the new file to the cloud
while not remote.exists_path(remote_hello_path):
    time.sleep(1)

remote_hello_info = remote.info_path(remote_hello_path)

# rename in the cloud
local_goodbye_path = local.join(local_root, "goodbye.txt")
remote_goodbye_path = remote.join(remote_root, "goodbye.txt")
print("renaming %s to %s on %s" % (remote_hello_path, remote_goodbye_path, provider_name))
remote.rename(remote_hello_info.oid, remote_goodbye_path)  # rename refers to the file to rename by oid

# wait for sync to cause the file to get renamed locally
while not local.exists_path(local_goodbye_path):
    time.sleep(1)

print("synced")

sync.stop(forever=True)
local.disconnect()
remote.disconnect()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/atakamallc/cloudsync",
    "name": "cloudsync",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "Atakama, LLC",
    "author_email": "dev-support@atakama.com",
    "download_url": "https://files.pythonhosted.org/packages/bf/12/1165803bd550bc7adf641c93c7eb28503bbf65619c225a596f5e975f4dab/cloudsync-2.4.7.tar.gz",
    "platform": "",
    "description": "[![Build Status](https://travis-ci.com/AtakamaLLC/cloudsync.svg?branch=master&token=WD7aozR2wQ3ePGe1QpA8)](https://travis-ci.com/AtakamaLLC/cloudsync)\n[![Code Coverage](https://codecov.io/gh/AtakamaLLC/cloudsync/branch/master/graph/badge.svg)](https://codecov.io/gh/AtakamaLLC/cloudsync)\n\n# cloudsync README\n\nPython Cloud Synchronization Library\n\n## Installation\n\n```bash\npip install cloudsync\n\n# install provider support\npip install cloudsync-gdrive\n```\n\n## Links\n\n*   [Documentation](https://atakama-llc-cloudsync.readthedocs-hosted.com/en/latest/)\n*   [Source Code + Issue Tracker](https://github.com/AtakamaLLC/cloudsync)\n\n## Command-line Example\n\n```bash\n\ncloudsync sync --help\n\ncloudsync sync file:c:/users/me/documents gdrive:/mydocs\n\n# on linux you can pass -D for 'daemon mode', which will detatch and run in the background\n```\n## Example of a single cloud provider integration\n\n```python\nimport cloudsync\n\n# Get a generic client_id and client_secret. Do not use this in production code.\n# For more information on getting your own client_id and client_secret, see README_OAUTH.md\noauth_config = cloudsync.command.utils.generic_oauth_config('gdrive')\n\n# get an instance of the gdrive provider class\nprovider = cloudsync.create_provider('gdrive', oauth_config=oauth_config)\n\n# Start the oauth process to login in to the cloud provider\ncreds = provider.authenticate()\n\n# Use the credentials to connect to the cloud provider\nprovider.connect(creds)\n\n# Perform cloud operations\nfor entry in provider.listdir_path(\"/\"):\n    print(entry.path)\n```\n## Example of a syncronization between two cloud providers\n\n```python\nimport cloudsync\nimport tempfile\nimport time\n\n# a little setup\nlocal_root = tempfile.mkdtemp()\nremote_root = \"/cloudsync_test/\" + time.strftime(\"%Y%m%d%H%M\")\nprovider_name = 'gdrive'\nprint(\"syncronizing between %s locally and %s on %s\" % (local_root, remote_root, provider_name))\n\n# Get a generic client_id and client_secret. Do not use this in production code.\n# For more information on getting your own client_id and client_secret, see README_OAUTH.md\ncloud_oauth_config = cloudsync.command.utils.generic_oauth_config(provider_name)\n\n# get instances of the local file provider and cloud provider from the provider factory\nlocal = cloudsync.create_provider(\"filesystem\")\nremote = cloudsync.create_provider(provider_name, oauth_config=cloud_oauth_config)\n\n# Authenticate with the remote provider using OAuth\ncreds = remote.authenticate()\n\n# Connect with the credentials acquired by authenticating with the provider\nlocal.namespace = local_root  # filesystem provider wants to know the root namespace before connecting\nlocal.connect(None)\nremote.connect(creds)\n\n# Create the folder on google drive to syncronize locally\nprint(\"Creating folder %s on %s\" % (remote_root, provider_name))\nremote.mkdirs(remote_root)  # provider.mkdirs() will automatically create any necessary parent folders\n\n# Specify which folders to syncronize\nsync_roots = (local_root, remote_root)\n\n# instantiate a new sync engine and start syncing\nsync = cloudsync.CloudSync((local, remote), roots=sync_roots)\nsync.start()\n\n# should sync this file as soon as it's noticed by watchdog\nlocal_hello_path = local.join(local_root, \"hello.txt\")\nprint(\"Creating local file %s\" % local_hello_path)\nwith open(local_hello_path, \"w\") as f:\n    f.write(\"hello\")\n\n# note remote.join, NOT os.path.join... Gets the path separator correct\nremote_hello_path = remote.join(remote_root, \"hello.txt\")\n\n# wait for sync to upload the new file to the cloud\nwhile not remote.exists_path(remote_hello_path):\n    time.sleep(1)\n\nremote_hello_info = remote.info_path(remote_hello_path)\n\n# rename in the cloud\nlocal_goodbye_path = local.join(local_root, \"goodbye.txt\")\nremote_goodbye_path = remote.join(remote_root, \"goodbye.txt\")\nprint(\"renaming %s to %s on %s\" % (remote_hello_path, remote_goodbye_path, provider_name))\nremote.rename(remote_hello_info.oid, remote_goodbye_path)  # rename refers to the file to rename by oid\n\n# wait for sync to cause the file to get renamed locally\nwhile not local.exists_path(local_goodbye_path):\n    time.sleep(1)\n\nprint(\"synced\")\n\nsync.stop(forever=True)\nlocal.disconnect()\nremote.disconnect()\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "cloudsync enables simple cloud file-level sync with a variety of cloud providers",
    "version": "2.4.7",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "ac89eff479843b6194966577a9022672",
                "sha256": "25cf64a593dbdbb73e81e687b4730099eb167a56a6d8d7d79426a4a462615b96"
            },
            "downloads": -1,
            "filename": "cloudsync-2.4.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ac89eff479843b6194966577a9022672",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 197744,
            "upload_time": "2021-01-13T19:38:59",
            "upload_time_iso_8601": "2021-01-13T19:38:59.156396Z",
            "url": "https://files.pythonhosted.org/packages/4b/ec/2706ce99ef3dba0f53e8872795140c513a8e41720935f4f3798de3738ef4/cloudsync-2.4.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "fd9332f51f9f4a0fc8d1a01d2efdd9a5",
                "sha256": "3ad806cba83dddad045654592de0fb120036b967fd284cbfc05d2a140b5f139b"
            },
            "downloads": -1,
            "filename": "cloudsync-2.4.7.tar.gz",
            "has_sig": false,
            "md5_digest": "fd9332f51f9f4a0fc8d1a01d2efdd9a5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 234125,
            "upload_time": "2021-01-13T19:39:01",
            "upload_time_iso_8601": "2021-01-13T19:39:01.330241Z",
            "url": "https://files.pythonhosted.org/packages/bf/12/1165803bd550bc7adf641c93c7eb28503bbf65619c225a596f5e975f4dab/cloudsync-2.4.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-01-13 19:39:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "atakamallc",
    "error": "Could not fetch GitHub repository",
    "lcname": "cloudsync"
}
        
Elapsed time: 0.22253s