Skip to content

ozeliurs/SMS-Api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TL-MR6400 SMS API

A FastAPI-based REST API for sending SMS messages through the TP-Link TL-MR6400 router web interface using Selenium.

Features

  • RESTful API for sending SMS messages
  • Secure API key authentication
  • Background task processing
  • Multi-platform Docker support (AMD64, ARM64, ARMv7, ARMv6)
  • Automated retry mechanism on failure

Prerequisites

  • Python 3.9+
  • Firefox browser
  • Docker (optional)
  • Docker Compose (optional)

Quick Start with Docker

# Clone the repository
git clone https://github.com/yourusername/TL-MR6400-SMS-Api
cd TL-MR6400-SMS-Api

# Create and configure your environment variables
cp .env.example .env
# Edit .env with your settings
nano .env

# Run with Docker Compose
docker-compose up -d

Development Setup

  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env
# Edit .env with your settings
  1. Run the development server:
uvicorn app:app --reload --host 0.0.0.0 --port 8000

Environment Variables

Create a .env file with the following variables:

BASE_URL=http://192.168.1.1  # Your router's URL
PASSWORD=your_password       # Your router's password
API_KEY=your_api_key        # Your chosen API key for the REST API

API Usage

Send an SMS:

curl -X POST "http://localhost:8000/send-sms" \
     -H "X-API-Key: your_api_key" \
     -H "Content-Type: application/json" \
     -d '{
           "phone_number": "+1234567890",
           "message": "Hello, World!"
         }'

Docker Support

The project includes multi-architecture Docker support:

# Pull the pre-built image
docker pull ghcr.io/yourusername/sms-api:latest

# Or build locally
docker build -t sms-api .

# Run the container
docker run -d \
  -p 8000:8000 \
  --env-file .env \
  --name sms-api \
  sms-api

Supported Architectures

  • AMD64 (x86_64)
  • ARM64 (aarch64)
  • ARMv7 (armhf)
  • ARMv6 (Raspberry Pi Zero)

Project Structure

TL-MR6400-SMS-Api/
├── app.py              # FastAPI application
├── sms_sender.py       # SMS sending logic
├── config.py           # Configuration management
├── requirements.txt    # Python dependencies
├── Dockerfile
├── docker-compose.yml
└── .env               # Environment variables (not in git)

Development

For development work:

  1. Install development dependencies:
pip install -r requirements.txt
pip install pytest pytest-cov black isort
  1. Format code:
black .
isort .
  1. Run tests:
pytest

API Documentation

After starting the server, access the API documentation at:

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

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

Acknowledgments

  • FastAPI framework
  • Selenium WebDriver
  • TP-Link TL-MR6400 router

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages