A sophisticated mock HTTP server for development and testing. Imitatus (Latin for "imitation") provides a powerful way to simulate HTTP services with precision and flexibility.
- 🔐 Token-based authentication system
- 🎯 Full HTTP method coverage (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, TRACE, CONNECT)
- 💾 Intelligent in-memory state management
- 📊 Request logging and analytics
- 🛡️ CORS support out of the box
- 🧪 Ready-to-use test collection
- ⚡ Zero external dependencies
# Install
git clone https://github.com/serkanaltuntas/imitatus.git
cd imitatus
pip install -r requirements.txt
# Run
python -m imitatus.server --port 8000
- Start the server:
python -m imitatus.server
- Authenticate:
curl -X POST http://localhost:8000/api/login \
-H "Content-Type: application/json" \
-d '{"username": "admin", "password": "password"}'
- Make requests:
curl http://localhost:8000/api/items \
-H "Authorization: Bearer your-token-here"
POST /api/login
: Get authentication token
{
"username": "admin",
"password": "password"
}
GET /api/items
: List all itemsPOST /api/items
: Create itemGET /api/items/{id}
: Get specific itemPUT /api/items/{id}
: Full updatePATCH /api/items/{id}
: Partial updateDELETE /api/items/{id}
: Delete item
GET /debug/vars
: System state and metricsOPTIONS /api/items
: Available methods and API info
- Python 3.8+
- pip
Imitatus is designed to have zero production dependencies. It uses only Python's standard library components for all core functionality. This design choice provides several benefits:
- 🔒 Enhanced security with no third-party dependency risks
- ⚡ Fast and lightweight installation
- 🎯 No version conflicts with other packages
- 📦 Maximum portability across Python environments
For development and testing, we use several high-quality tools:
# Install development dependencies
pip install -r requirements-dev.txt
# Install testing dependencies
pip install -r requirements-test.txt
See requirements-dev.txt
and requirements-test.txt
for the complete list of development and testing dependencies.
We welcome contributions! Please see our Contributing Guidelines for details.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with precision by Serkan Altuntas
- Submit issues via GitHub
- Review documentation