Skip to main content

python-rclone

License Build Status

A Python wrapper for rclone.

rclone must be already installed and discoverable in $PATH.

Status

Work in progress. Experimental.

Usage

import rclone

cfg = """[local]
type = local
nounc = true"""
result = rclone.with_config(cfg).listremotes()

print(result.get('out'))
# b'local:\n'
print(result.get('code'))
# 0
print(result.get('error'))

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:

import rclone

cfg = """[local]
type = local
nounc = true"""
result = rclone.with_config(cfg).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")

import rclone

cfg = """[local]
type = local
nounc = true"""
result = rclone.with_config(cfg).listremotes()

Developer guide

$ pip install -r requirements.txt
$ make test

Metadata

Release files for python-rclone 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-rclone 0.0.2
File Size Uploaded
python-rclone-0.0.2.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-rclone 0.0.2
File Interpreter ABI Platform
python_rclone-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / python-rclone-0.0.2.tar.gz

Download URL python-rclone-0.0.2.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
210e8c613f0f8b541b7caad402c4b7c841e259a11f831668472288bcc808c597
BLAKE2b-256 checksum
How to use checksums
5551d3a184647954aeddec78dd83f798921bfc20d2791f1b85c1705cc7fe8a37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release files / python_rclone-0.0.2-py3-none-any.whl

Download URL python_rclone-0.0.2-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
899a80c7212a9e377206b31aece3bfba80396e57c78ec5b9ad6f6c9fe8a4f772
BLAKE2b-256 checksum
How to use checksums
0efd55fc62562c8c6eff7f9a9a9c2a35167ad736362d09ec49c8f4d47586e808
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.0

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page