CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-rclone-python

A python wrapper for rclone that makes rclone's functionality usable in python applications.

Pending
Overview
Eval results
Files

remote-management.mddocs/

Remote Management

Functions for creating, configuring, and managing cloud storage remotes. Supports OAuth authentication, custom configuration options, and comprehensive remote validation across 70+ cloud storage providers.

Capabilities

Remote Creation

Create new remotes with OAuth authentication and custom configuration options for any supported cloud storage provider.

def create_remote(remote_name: str, remote_type: Union[str, RemoteTypes], 
                  client_id: Union[str, None] = None, client_secret: Union[str, None] = None, **kwargs):
    """
    Creates a new rclone remote with name, type, and configuration options.
    
    Parameters:
    - remote_name (str): Name for the new remote (must be unique)
    - remote_type (Union[str, RemoteTypes]): Cloud provider type (e.g., "onedrive", RemoteTypes.dropbox)
    - client_id (str, optional): OAuth Client ID for custom authentication
    - client_secret (str, optional): OAuth Client Secret for custom authentication  
    - **kwargs: Additional key-value pairs for rclone config create command
    
    Returns:
    None
    
    Raises:
    Exception: If remote with same name already exists
    RcloneException: If remote creation fails
    """

Remote Listing

List all configured remotes and check for specific remote existence.

def get_remotes() -> List[str]:
    """
    Retrieves list of all configured rclone remotes.
    
    Returns:
    List[str]: List of remote names with trailing colons (e.g., ['onedrive:', 'box:'])
    """

def check_remote_existing(remote_name: str) -> bool:
    """
    Checks if a specific rclone remote is configured.
    
    Parameters:
    - remote_name (str): Name of remote to check (with or without trailing ':')
    
    Returns:
    bool: True if remote exists, False otherwise
    """

Usage Examples

Basic Remote Creation

from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

# Create OneDrive remote with default OAuth
rclone.create_remote('onedrive', RemoteTypes.onedrive)

# Create Dropbox remote using string type
rclone.create_remote('dropbox', 'dropbox')

# Check if remote was created
if rclone.check_remote_existing('onedrive'):
    print("OneDrive remote successfully created")

Custom OAuth Credentials

from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

# Create remote with custom OAuth credentials
rclone.create_remote(
    'my_onedrive',
    RemoteTypes.onedrive,
    client_id='your_client_id_here',
    client_secret='your_client_secret_here'
)

Advanced Remote Configuration

from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

# Create S3 remote with additional configuration
rclone.create_remote(
    'aws_s3',
    RemoteTypes.s3,
    access_key_id='your_access_key',
    secret_access_key='your_secret_key',
    region='us-west-2',
    provider='AWS'
)

# Create SFTP remote with authentication
rclone.create_remote(
    'my_server',
    RemoteTypes.sftp,
    host='server.example.com',
    user='username',
    port='22',
    key_file='/path/to/private/key'
)

Remote Management Workflow

from rclone_python import rclone
from rclone_python.remote_types import RemoteTypes

# List all existing remotes
existing_remotes = rclone.get_remotes()
print(f"Configured remotes: {existing_remotes}")

# Check before creating to avoid conflicts
remote_name = 'my_drive'
if not rclone.check_remote_existing(remote_name):
    rclone.create_remote(remote_name, RemoteTypes.drive)
    print(f"Created new remote: {remote_name}")
else:
    print(f"Remote {remote_name} already exists")

# Verify creation
updated_remotes = rclone.get_remotes()
print(f"Updated remotes: {updated_remotes}")

Supported Remote Types

The RemoteTypes enum includes 72 different cloud storage providers:

Major Cloud Providers

  • onedrive: Microsoft OneDrive
  • drive: Google Drive
  • dropbox: Dropbox
  • box: Box
  • s3: Amazon S3
  • azureblob: Azure Blob Storage
  • azurefiles: Azure Files

Storage Systems

  • local: Local filesystem
  • sftp: SFTP servers
  • ftp: FTP servers
  • webdav: WebDAV servers
  • smb: SMB/CIFS shares

Specialized Providers

  • b2: Backblaze B2
  • mega: MEGA
  • pcloud: pCloud
  • koofr: Koofr
  • yandex: Yandex Disk
  • mailru: Mail.ru Cloud

And 50+ Additional Providers

Including enterprise storage, backup services, file hosting platforms, and specialized cloud storage solutions.

Configuration Options

Different remote types support various configuration parameters:

OAuth-based Providers (OneDrive, Google Drive, Dropbox)

  • client_id: Custom OAuth application ID
  • client_secret: Custom OAuth application secret
  • token: Pre-obtained OAuth token (advanced)

S3-compatible Providers

  • access_key_id: Access key for authentication
  • secret_access_key: Secret key for authentication
  • region: Storage region
  • endpoint: Custom S3 endpoint URL
  • provider: Specific S3 provider (AWS, Minio, etc.)

SFTP/FTP Providers

  • host: Server hostname or IP
  • user: Username for authentication
  • port: Connection port
  • key_file: Path to SSH private key
  • password: Password authentication

Enterprise Systems

  • Custom authentication parameters
  • SSL/TLS configuration
  • Proxy settings
  • Advanced connection options

Install with Tessl CLI

npx tessl i tessl/pypi-rclone-python

docs

configuration.md

file-listing.md

file-management.md

file-transfer.md

hash-operations.md

index.md

public-links.md

remote-management.md

tile.json