A python wrapper for rclone that makes rclone's functionality usable in python applications.
npx @tessl/cli install tessl/pypi-rclone-python@0.1.0A comprehensive Python wrapper for the rclone command-line tool that enables programmatic access to cloud storage operations. It provides a rich, Python-native interface for copying, moving, syncing files across 70+ cloud storage providers with progress tracking, authentication management, and comprehensive error handling.
pip install rclone-pythonfrom rclone_python import rcloneFor hash types and remote types:
from rclone_python.hash_types import HashTypes
from rclone_python.remote_types import RemoteTypesFor exceptions:
from rclone_python.utils import RcloneExceptionfrom rclone_python import rclone
from rclone_python.remote_types import RemoteTypes
# Check if rclone is installed
if rclone.is_installed():
# Create a new remote for OneDrive
rclone.create_remote('onedrive', RemoteTypes.onedrive)
# Copy files from OneDrive to local directory
rclone.copy('onedrive:data', 'local_data', show_progress=True)
# List files in a remote directory
files = rclone.ls('onedrive:data', max_depth=1, files_only=True)
# Sync local directory to remote
rclone.sync('local_data', 'onedrive:backup')The rclone-python wrapper is built around several key components:
The wrapper maintains compatibility with all rclone command-line options while providing Python-native interfaces, progress callbacks, and structured return values.
Core transfer functionality including copy, move, and sync operations with progress tracking, custom progress bars, and event listeners for real-time transfer monitoring.
def copy(in_path: str, out_path: str, ignore_existing=False, show_progress=True,
listener: Callable[[Dict], None] = None, args=None, pbar=None): ...
def move(in_path: str, out_path: str, ignore_existing=False, show_progress=True,
listener: Callable[[Dict], None] = None, args=None, pbar=None): ...
def sync(src_path: str, dest_path: str, show_progress=True,
listener: Callable[[Dict], None] = None, args=None, pbar=None): ...Functions for creating, configuring, and managing cloud storage remotes with OAuth authentication support and comprehensive remote validation.
def create_remote(remote_name: str, remote_type: Union[str, RemoteTypes],
client_id: Union[str, None] = None, client_secret: Union[str, None] = None, **kwargs): ...
def get_remotes() -> List[str]: ...
def check_remote_existing(remote_name: str) -> bool: ...Comprehensive file system operations including directory listing, file metadata, storage quotas, and tree-style directory visualization.
def ls(path: str, max_depth: Union[int, None] = None, dirs_only=False,
files_only=False, args=None) -> List[Dict[str, Union[int, str]]]: ...
def about(path: str) -> Dict: ...
def size(path: str, args: List[str] = None) -> Dict: ...
def tree(path: str, args: List[str] = None) -> str: ...Essential file management functions including directory creation, file deletion, content output, and batch operations with comprehensive argument support.
def mkdir(path: str, args=None): ...
def delete(path: str, args=None): ...
def purge(path: str, args=None): ...
def cat(path: str, count: Optional[int] = None, head: Optional[int] = None,
offset: Optional[int] = None, tail: Optional[int] = None, args=None) -> str: ...Data integrity operations including hash generation, validation, and file comparison with support for multiple hash algorithms and checksum verification.
def hash(hash: Union[str, HashTypes], path: str, download=False,
checkfile: Optional[str] = None, output_file: Optional[str] = None,
args: List[str] = None) -> Union[None, str, bool, Dict[str, str], Dict[str, bool]]: ...
def check(source: str, dest: str, combined: str = None, size_only: bool = False,
download: bool = False, one_way: bool = False, args: List[str] = None
) -> Tuple[bool, List[Tuple[str, str]]]: ...Functions for generating, managing, and removing public links to files and directories with expiration support where available.
def link(path: str, expire: Union[str, None] = None, unlink=False, args=None) -> str: ...System-level operations including installation checking, version management, configuration file handling, and logging control.
def is_installed() -> bool: ...
def version(check=False, args: List[str] = None) -> Union[str, Tuple[str]]: ...
def set_config_file(config_file: str): ...
def set_log_level(level: int): ...from typing import Dict, List, Union, Optional, Callable, Tuple
# Progress listener callback type
ProgressListener = Callable[[Dict], None]
# Transfer operation parameters
TransferArgs = Optional[List[str]]from enum import Enum
class HashTypes(Enum):
crc32 = "crc32"
dropbox = "dropbox"
hidrive = "hidrive"
mailru = "mailru"
md5 = "md5"
quickxor = "quickxor"
sha1 = "sha1"
sha256 = "sha256"
sha512 = "sha512"
whirlpool = "whirlpool"from enum import Enum
class RemoteTypes(Enum):
# Major cloud providers
onedrive = "onedrive"
drive = "drive" # Google Drive
dropbox = "dropbox"
box = "box"
s3 = "s3" # Amazon S3
azureblob = "azureblob"
# Storage systems (72 total providers supported)
local = "local"
sftp = "sftp"
ftp = "ftp"
webdav = "webdav"
# ... and 65+ additional cloud storage providersclass RcloneException(ChildProcessError):
def __init__(self, description: str, error_msg: str): ...
# Properties
description: str # High-level error description
error_msg: str # Detailed error message from rclone