Skip to main content

Tello mobile plan automatic renewal system

Project description

Tello-Renewal

中文版 | English Version

Automatic renewal system for Tello mobile plans using web automation.

Features

  • 🔄 Automatic plan renewal using Selenium web automation
  • 📧 Email notifications for success/failure
  • 🧪 Dry run mode for testing
  • ⚙️ TOML configuration with validation
  • 🔒 Secure credential handling
  • 📊 Comprehensive logging
  • 🐳 Docker support with reusable base images

Installation

From Source

# Clone the repository
git clone <repository-url>
cd tello-renewal

# Install in development mode
pip install -e .

# Or install from PyPI (when published)
pip install tello-renewal

Requirements

  • Python 3.10+
  • Firefox, Chrome, or Edge browser
  • WebDriver for your chosen browser (geckodriver for Firefox)

Quick Start

  1. Create configuration file:

    tello-renewal config-init
    
  2. Edit the configuration:

    # Edit config.toml with your settings
    nano config.toml
    
  3. Test your configuration:

    # Validate configuration
    tello-renewal config-validate
    
    # Test email notifications
    tello-renewal email-test
    
    # Check account status
    tello-renewal status
    
  4. Run renewal (dry run first):

    # Test renewal without actually renewing
    tello-renewal renew --dry-run
    
    # Perform actual renewal
    tello-renewal renew
    

Configuration

The system uses TOML configuration files. Here's a minimal example:

[tello]
email = "your_email@example.com"
password = "your_password"
card_expiration = "1/25"  # MM/YY format

[smtp]
server = "smtp.gmail.com"
port = 587
username = "your_email@gmail.com"
password = "your_app_password"
from_email = '"Tello Renewal" <your_email@gmail.com>'

[notifications]
email_enabled = true
recipients = ["admin@example.com"]

Configuration Sections

  • [tello] - Tello account credentials and settings
  • [browser] - Browser automation settings
  • [renewal] - Renewal behavior configuration
  • [smtp] - Email server settings
  • [notifications] - Notification preferences
  • [logging] - Logging configuration

CLI Commands

Basic Operations

# Execute renewal
tello-renewal renew [--dry-run]

# Check account status and balance information
tello-renewal status

Configuration Management

# Create example configuration
tello-renewal config-init [--output config.toml]

# Validate configuration
tello-renewal config-validate

Testing

# Test email notifications
tello-renewal email-test

Options

  • --config, -c - Specify configuration file path
  • --verbose, -v - Enable verbose logging
  • --help - Show help information

Exit Codes

Code Meaning
0 Success
1 General error
2 Configuration error
5 Renewal failed
6 Not due for renewal

Scheduling

Cron Job

Add to your crontab to run daily:

# Run daily at 9 AM
0 9 * * * /path/to/venv/bin/tello-renewal renew

# With logging
0 9 * * * /path/to/venv/bin/tello-renewal renew >> /var/log/tello-renewal.log 2>&1

Systemd Service

Create /etc/systemd/system/tello-renewal.service:

[Unit]
Description=Tello Plan Auto Renewal
After=network.target

[Service]
Type=oneshot
User=tello
WorkingDirectory=/opt/tello-renewal
ExecStart=/opt/tello-renewal/venv/bin/tello-renewal renew

Create /etc/systemd/system/tello-renewal.timer:

[Unit]
Description=Run Tello renewal daily
Requires=tello-renewal.service

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target

Enable and start:

sudo systemctl enable tello-renewal.timer
sudo systemctl start tello-renewal.timer

Security Considerations

  • Store sensitive configuration files with restricted permissions (600)
  • Use app passwords for email authentication
  • Consider encrypting configuration files containing passwords
  • Run with minimal privileges
  • Regularly update dependencies

Troubleshooting

Common Issues

  1. WebDriver not found:

    # Install geckodriver for Firefox
    # On Ubuntu/Debian:
    sudo apt install firefox-geckodriver
    
    # On macOS:
    brew install geckodriver
    
  2. Login failures:

    • Verify credentials in configuration
    • Check if Tello website structure has changed
    • Try running with --verbose for detailed logs
  3. Email sending failures:

    • Verify SMTP settings
    • Use app passwords for Gmail
    • Test with tello-renewal email-test
  4. Browser automation issues:

    • Try different browser types in configuration
    • Disable headless mode for debugging
    • Check browser and WebDriver versions

Debug Mode

Run with verbose logging to troubleshoot issues:

tello-renewal --verbose renew --dry-run

Log Files

Check log files for detailed error information:

tail -f tello_renewal.log

Docker Usage

For detailed Docker usage instructions, see docker/README_en.md or docker/README_zh.md.

Quick Docker Start

# Build and run with Docker
make docker-build
docker run --rm -v $(pwd)/config:/app/config oaklight/tello-renewal:latest

# Or use the provided scripts
./scripts/run.sh --help

Available Docker Commands

# Build base image (Alpine Python + Selenium + geckodriver)
make docker-build-base
make docker-push-base

# Build application image
make docker-build
make docker-push

# Clean up
make docker-clean

Development

Setup Development Environment

# Clone repository
git clone <repository-url>
cd tello-renewal

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode with dev dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=tello_renewal

# Run specific test file
pytest tests/test_models.py

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This software is provided as-is for educational and automation purposes. Users are responsible for:

  • Ensuring compliance with Tello's terms of service
  • Maintaining the security of their credentials
  • Monitoring the renewal process
  • Having backup payment methods available

The authors are not responsible for any service interruptions, failed renewals, or other issues that may arise from using this software.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tello_renewal-0.1.1.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tello_renewal-0.1.1-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file tello_renewal-0.1.1.tar.gz.

File metadata

  • Download URL: tello_renewal-0.1.1.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for tello_renewal-0.1.1.tar.gz
Algorithm Hash digest
SHA256 aef1a38be17f347700b83901cdd7144e80fbee8f4da1728d6125c0ef9af4295d
MD5 1057c57338aef3ac8fd6de468967a521
BLAKE2b-256 cf273f29a31dd688ec874ce46c693e7fe82674a33013eccacf48e3924ee3bd8a

See more details on using hashes here.

File details

Details for the file tello_renewal-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: tello_renewal-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 25.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for tello_renewal-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 baaa69a9920a2ef3f5005ecd7bb2ec7bdb4319ad52ae75d3c792c6ab6f3dca6f
MD5 87abf3d9b6527f005a4f843aed93ea5c
BLAKE2b-256 61064d218d43cd964bb639ea1207bab95aa5489587216aa3385d857fff5e358a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page