Skip to main content

A package that provides a wrapper for RClone

Project description

PyRCLONE

A Python wrapper for rclone.

This package, available on PyPI, conveniently includes the rclone binary (version v1.62.2) eliminating the need for pre-installation of rclone. It caters to various operating systems like Windows, Mac, and Linux, and supports both amd64 and x86_64 architectures. When a user downloads the package, the appropriate rclone binary file is installed based on their system type.

Install

pip install pyrclone-wrapper

Usage

from pyrclone import RCloneWrapper


config = {
    "remote_name": {
        'type': 'google cloud storage',
        'project_number': "project_number",
        'service_account_file': "path/to/service_account_file.json",
        'object_acl': 'private',
        'bucket_acl': 'private',
        'location': 'us',
        'storage_class': 'STANDARD'
    }
}
rclone = RCloneWrapper(config)
result = rclone.listremotes()
print(result.get('out'))
# b'remote_name:\n'
print(result.get('code'))
# 0
print(result.get('error'))
# b''

Implemented commands:

  • copy Copy files from source to dest, skipping already copied
  • sync Make source and dest identical, modifying destination only.
  • listremotes List all the remotes in the config file.
  • ls List the objects in the path with size and path.
  • lsjson List directories and objects in the path in JSON format.
  • delete Remove the contents of path.

Even if not all rclone commands have been exposed, it's possible to invoke any command using run_cmd method directly, as shown in the example bellow:

from pyrclone import RCloneWrapper

config = {
    "local": {
        'type': 'local',
        'nounc': True,
    }
}
result = RCloneWrapper(config).run_cmd(command="lsd", extra_args=["local:/tmp", "-v", "--dry-run"])

Logging and Debugging

To see more info about which commands are executed, or what other messages they print, you can enable logging as the example bellow shows:

import logging
logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s %(name)s [%(levelname)s]: %(message)s")

from pyrclone import RCloneWrapper

config = {
    "local": {
        'type': 'local',
        'nounc': True,
    }
}
rclone = RCloneWrapper(config)
result = rclone.listremotes()

Limitation

Only support windows, mac and, linux operating system and arch with amd64 and x86_64.

windwos: amd64

linux: amd64, x86_64

darwin(mac): amd64, x86_64

Developer guide

$ pip install wheel twine pytest
$ make test

Reference

python-rclone ( base on this project and improve it )

rclone

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyrclone_wrapper-0.0.3-py3-none-win_amd64.whl (16.3 MB view details)

Uploaded Python 3 Windows x86-64

pyrclone_wrapper-0.0.3-py3-none-macosx_10_9_x86_64.whl (19.7 MB view details)

Uploaded Python 3 macOS 10.9+ x86-64

File details

Details for the file pyrclone_wrapper-0.0.3-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for pyrclone_wrapper-0.0.3-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f61b704df748b6cba8d1382cd78fb8a93878a21008ac663452ca03e8847992c5
MD5 bae9da8ad637ce86565067decb3e878f
BLAKE2b-256 0be74ae6f6e5f600023a1c36f0ab9cea759e56eaba41f7ca4483e939ca023530

See more details on using hashes here.

File details

Details for the file pyrclone_wrapper-0.0.3-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for pyrclone_wrapper-0.0.3-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7782204975de2d41b363ab934f213293bd72e3b517ef6efd26be59ec51da9a20
MD5 ea002208859f5682e8dac27cc90d0f65
BLAKE2b-256 019903b7bbc2d6c97a448c22234660dd2a52b2e7784c57327d79b2b25547965d

See more details on using hashes here.

File details

Details for the file pyrclone_wrapper-0.0.3-py3-none-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for pyrclone_wrapper-0.0.3-py3-none-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e00187e28e7ffbedd4cc6289dd4a72f3db5a7aeca7c5bc217429bf65a80f3fce
MD5 f030de85670ea5f882beb983be694b79
BLAKE2b-256 5c27a1e36c53399067c2f4184694a5b7e7cb129c818d70a3f6440084f711c9bb

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