Command Line Interface

RateThrottle includes a CLI for testing, monitoring, and management.

Installation

The CLI is included with RateThrottle:

pip install ratethrottle

Usage

Basic Commands

# Show help
ratethrottle --help

Testing Rate Limits

# Test a rate limit
ratethrottle test --rule api_limit --requests 100

# Test with specific identifier
ratethrottle test --rule api_limit --identifier user123 --requests 50

Viewing Metrics

# Show current metrics
ratethrottle metrics

# Show metrics for specific rule
ratethrottle metrics --rule api_limit

Managing Whitelist/Blacklist

# Add to whitelist
ratethrottle --whitelist-add 10.0.0.1

# Remove from whitelist
ratethrottle --whitelist-remove 10.0.0.1

# List whitelist
ratethrottle --list-all

# Add to blacklist
ratethrottle --blacklist-add 192.168.1.100

Statistics

# Export analytics report
ratethrottle stats --export report.json

# Include raw data in report
ratethrottle stats --raw-data

Configuration

# Validate configuration file
ratethrottle config --validate config.yaml

# Show current configuration
ratethrottle config --show

Next Steps