A Python application that monitors Amazon product prices and sends notifications when prices drop below your target thresholds. Built with Crawl4AI for reliable price extraction and supports multiple notification methods.
- Smart Price Extraction: Crawl4AI for Amazon price scraping
- Notification: email alerts
- Price History Tracking: Maintains historical price data with timestamps
- Continuous Monitoring: Runs in background with configurable check intervals
- Docker Support: Ready-to-run Docker container for Raspberry Pi and other platforms
SMTP_SENDER_EMAIL= SMTP_SENDER_PASSWORD= SMTP_RECIPIENT_EMAIL= SMTP_SERVER=smtp.gmail.com SMTP_PORT=587
hostname -I # On the Pi- Clone and setup:
git clone <your-repo-url>
cd amazon-price-monitor
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt
playwright install- Configure your products:
cp config.example.json config.json
# Edit config.json with your product URLs and notification settings- Run the monitor:
python amazon_price_monitor.py- Setup:
chmod +x setup-pi.sh
./setup-pi.sh- Configure and run:
# Edit config.json with your settings
docker-compose up -d- Monitor logs:
docker-compose logs -fEdit config.json to customize your monitoring:
{
"products": [
{
"name": "Product Name",
"url": "https://www.amazon.com/gp/product/B0XXXXXXXX/",
"target_price": 50.00
}
],
"check_interval_minutes": 60,
"email_notifications": {
"enabled": true
}
}For Gmail notifications:
- Enable 2-Factor Authentication
- Generate an App Password
- Use the app password (not your regular password) in
config.json
- Email Alerts: SMTP email notifications
amazon-price-monitor/
βββ README.md
βββ .env.example
βββ .env # Your actual environment variables
βββ .gitignore
βββ requirements.txt
βββ docker-compose.yml
βββ Dockerfile
βββ setup.py # Package setup
β
βββ app/ # Main application package
β βββ __init__.py
β βββ main.py # FastAPI app entry point
β βββ config.py # Configuration management
β βββ dependencies.py # FastAPI dependencies
β β
β βββ api/ # API routes
β β βββ __init__.py
β β βββ deps.py # API dependencies
β β βββ v1/ # API version 1
β β βββ __init__.py
β β βββ api.py # Main API router
β β βββ endpoints/
β β βββ __init__.py
β β βββ products.py
β β βββ monitoring.py
β β βββ status.py
β β
β βββ core/ # Core business logic
β β βββ __init__.py
β β βββ config.py # Settings and configuration
β β βββ security.py # Security utilities
β β βββ logging.py # Logging configuration
β β
β βββ models/ # Pydantic models
β β βββ __init__.py
β β βββ product.py
β β βββ monitoring.py
β β βββ
β β
β βββ services/ # Business logic services
β β βββ __init__.py
β β βββ price_monitor.py # Main monitoring service
β β βββ notification.py # Notification service
β β βββ price_extractor.py # Price extraction service
β β
β βββ utils/ # Utility functions
β βββ __init__.py
β βββ
β βββ exceptions.py
β
βββ frontend/ # React frontend
β βββ public/
β βββ src/
β βββ package.json
β βββ ...
β
βββ tests/ # Test files
β βββ __init__.py
β βββ conftest.py
β βββ test_api/
β βββ test_services/
β βββ test_utils/
β
βββ scripts/ # Utility scripts
β βββ
β βββ
β βββ
β
βββ data/ # Data directory
β βββ config.json
β βββ price_history.json
β βββ logs/
β βββ app.log
β
βββ docs/ # Documentation
βββ
βββ
βββ
Perfect for running 24/7 on a Raspberry Pi or server:
# Build image
docker-compose build
# Run in background
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose down- Use email notifications instead of desktop notifications
- Consider longer check intervals (2-4 hours) to reduce load
- Monitor resource usage:
docker stats - Logs are persistent in
./logs/directory
- Application logs:
price_monitor.log - Price history:
price_history.json - Docker logs:
docker-compose logs
# Check if container is healthy
docker-compose ps
# View resource usage
docker stats
# Follow live logs
docker-compose logs -f amazon-price-monitorAdd multiple products to monitor in config.json:
"products": [
{
"name": "Echo Dot",
"url": "https://amazon.com/dp/B0757911C2",
"target_price": 30.00
},
{
"name": "iPad",
"url": "https://amazon.com/dp/B09G9FPHY6",
"target_price": 300.00
}
]"check_interval_minutes": 120 // Check every 2 hoursPlaywright Browser Error:
playwright installPermission Denied (Docker):
sudo usermod -aG docker $USER
# Log out and back inPrice Extraction Fails:
- Check if Amazon URL is accessible
- Verify product page format hasn't changed
- Check logs for specific error messages
Email Notifications Not Working:
- Verify SMTP settings
- Use app passwords for Gmail
- Check firewall settings
Add verbose logging:
logging.basicConfig(level=logging.DEBUG)- Check Intervals: Don't check too frequently (Amazon may block)
- Resource Monitoring: Use
docker statsto monitor usage - Log Rotation: Implement log rotation for long-running instances
- Multiple Instances: Run separate containers for different product categories
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is for personal use only. Please respect Amazon's terms of service and robots.txt. Don't overload their servers with too frequent requests.
Happy deal hunting! π―


