A Python-based command-line tool for remotely managing qBittorrent instances via the Web API
Project description
qBittorrent Remote Client
A Python-based command-line tool for remotely managing qBittorrent instances via the Web API.
Project Status
🚀 Active Development - This project is actively maintained with comprehensive CI/CD pipeline
- ✅ Tests: 43/43 passing (100% pass rate) with 75% code coverage
- ✅ CI/CD: Multi-Python testing (3.9-3.12) with automated quality checks
- ✅ Security: Automated vulnerability scanning with Bandit
- ✅ Code Quality: Black formatting, isort imports, mypy type checking
- ✅ Branch Protection: Main branch protected with required status checks
- ✅ Documentation: Comprehensive README with usage examples
Features
- 🖥️ Comprehensive Status Dashboard - Real-time monitoring with rich formatted display
- 📋 List and Filter Torrents - View torrents with detailed information and filtering
- ➕ Add Torrents - From magnet links, URLs, or torrent files with category support
- 🏷️ Category Management - List categories and organize torrents automatically
- ⏸️ Control Torrents - Pause, resume, and delete operations
- 🗑️ Bulk Operations - Delete torrents by status (error, missingFiles, etc.)
- 📊 Transfer Statistics - Global transfer info and session statistics
- 🔄 Auto-refresh Mode - Real-time monitoring with configurable refresh intervals
- 🎯 Interactive Mode - Interactive shell for quick operations
- ⚡ Automation Ready - CLI flags for scripting and automation
Status Dashboard
Get a comprehensive overview of your qBittorrent instance:
# One-time status check
qbt-client status
# Auto-refresh every 5 seconds for monitoring
qbt-client status --refresh 5
The dashboard shows:
- 🖥️ Server information (version, connection, protocol)
- 📊 Transfer statistics (speeds, session/all-time totals)
- 📚 Torrent overview (counts, sizes, active transfers)
- 📈 Status breakdown with color-coded percentages
- 🚀 Most active torrents with progress and speeds
Installation
From PyPI (Recommended)
pip install qbittorrent-remote-client
After installation, you can use the qbt-client command directly from anywhere:
qbt-client --help
From Source
From Source
-
Clone and install from source:
git clone https://github.com/ryanlong1004/qbittorrent-remote-client.git cd qbittorrent-remote-client pip install .
-
For development:
git clone https://github.com/ryanlong1004/qbittorrent-remote-client.git cd qbittorrent-remote-client pip install -e .
Setup
After installation, you need to configure the connection to your qBittorrent instance:
-
Enable Web UI in qBittorrent:
- Go to Tools → Preferences → Web UI
- Check "Web User Interface"
- Set username/password
- Note the port (default: 8080)
-
Create configuration file:
# Download example config curl -O https://raw.githubusercontent.com/ryanlong1004/qbittorrent-remote-client/main/config.example.json cp config.example.json config.json # Edit config.json with your qBittorrent details
Or create
config.jsonmanually with your qBittorrent details:{ "host": "localhost", "port": 8080, "username": "admin", "password": "your_password", "use_https": false }
Development Setup
# Clone and setup development environment
git clone https://github.com/ryanlong1004/qbittorrent-remote-client.git
cd qbittorrent-remote-client
# Set up development environment
make dev-setup
# Run tests
make test
# Run tests with coverage
make test-cov
# Run all CI checks locally
make ci
Developer Workflow
To avoid CI/CD formatting failures, always run these commands before committing:
# Format code automatically
make format
# Check formatting (what CI/CD runs)
make format-check
# Run all quality checks locally (same as CI/CD)
make ci
# Or run pre-commit hooks manually
make pre-commit
Pro Tip: Pre-commit hooks are installed automatically and will format code before each commit!
Testing
This project includes a comprehensive test suite with:
- Unit Tests - Complete coverage of API and CLI functionality
- Integration Tests - End-to-end testing scenarios
- Code Quality - Automated linting, formatting, and security checks
- CI/CD Pipeline - GitHub Actions workflow for continuous testing
# Run all tests
pytest
# Run with coverage report
pytest --cov
# Run specific test file
pytest tests/test_qbt_api.py
# Run tests matching pattern
pytest -k "test_status"
Usage
# List all torrents
qbt-client list
# List available categories
qbt-client categories
# Add torrent from magnet link
qbt-client add "magnet:?xt=urn:btih:..."
# Add torrent to specific category
qbt-client add "magnet:?xt=urn:btih:..." --category Films
# Add torrent from file with category and custom path
qbt-client add /path/to/file.torrent --category Music --path /custom/path
# Pause torrents
qbt-client pause <hash1> <hash2>
# Resume torrents
qbt-client resume <hash1> <hash2>
# Delete torrents
qbt-client delete <hash1> --delete-files
# Delete all torrents with specific status (with preview)
qbt-client delete-by-status error --dry-run
# Delete all torrents with specific status
qbt-client delete-by-status missingFiles --delete-files
# Get statistics
qbt-client stats
# Show comprehensive status dashboard
qbt-client status
# Auto-refresh status every 5 seconds
qbt-client status --refresh 5
# Interactive mode
qbt-client interactive
Alternative: Using Python Module
If you prefer to run as a Python module:
# List all torrents
python -m qbittorrent_remote_client.qbt_client list
# Or if using development environment with source
qbt-client list
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file qbittorrent_remote_client-0.2.0.tar.gz.
File metadata
- Download URL: qbittorrent_remote_client-0.2.0.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43a85759e17fe535e6ab8f6f9dcd6674c31e2a890fb11582af228cd48f6a5077
|
|
| MD5 |
054b16d0b91a72ec6427d1f004e349a6
|
|
| BLAKE2b-256 |
e0e4ae20bf103df66cb688089793f31b2216155c664056b1ce6d56adfc29050d
|
File details
Details for the file qbittorrent_remote_client-0.2.0-py3-none-any.whl.
File metadata
- Download URL: qbittorrent_remote_client-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74741e1bc21a345cf0c6bfcb7127eea64006eda2e9081e65c7ea926fefd68f17
|
|
| MD5 |
f9cf1de83b2c5ca1945c6904b2f5e2b3
|
|
| BLAKE2b-256 |
1ca47a85d9f3cf82ff344bf0de3743a14c8a9740156af4d6167ec36f9fb2ee73
|