A comprehensive, production-ready price monitoring system that tracks product prices across multiple e-commerce platforms with automated alerts, historical analysis, and beautiful visualizations.
- π Multi-Platform Support: Amazon, Flipkart, and generic e-commerce sites
- π Real-Time Monitoring: Automated price checking with smart scheduling
- π― Target Price Alerts: Get notified when products reach your desired price
- π Historical Analysis: Track price trends over time with detailed charts
- πΎ Database Storage: SQLite for local use, PostgreSQL for production
- π Smart Scraping: User agent rotation and anti-detection mechanisms
- π§ Email Notifications: Professional email alerts for price changes
- π± REST API: FastAPI-powered API for integration with other applications
- π Data Visualization: Beautiful charts with matplotlib and seaborn
- π Export Options: CSV and Excel reports for external analysis
- β‘ Performance Optimized: Efficient database queries and caching
- π‘οΈ Error Handling: Comprehensive logging and graceful failure recovery
- π§ Highly Configurable: Customizable scraping rules and alert conditions
- π Scalable Architecture: Handle thousands of products efficiently
- Python 3.8 or higher
- pip package manager
-
Clone the repository:
git clone https://github.com/DevAniketIT/Price-Monitor-System.git cd price-monitor-system
-
Install dependencies:
pip install -r requirements.txt
-
Run the demo:
python price_monitor_system.py
from price_monitor_system import PriceMonitor
# Initialize the monitor
monitor = PriceMonitor()
# Add a product to monitor
product_id = monitor.add_product(
name="iPhone 15 Pro",
url="https://amazon.com/dp/B0CHX9CY7W",
target_price=999.00
)
# Check prices manually
monitor.check_single_product(product_id)
# Or check all products
monitor.check_all_products()
# Generate reports
report = monitor.get_summary_report()
chart_file = monitor.generate_price_chart(product_id)
The system consists of several key components:
- PriceMonitor: Core monitoring class with scraping logic
- Database Layer: SQLite/PostgreSQL for data persistence
- EmailNotifier: Automated email alert system
- API Layer: FastAPI REST endpoints for external integration
- Visualization: Chart generation and data export utilities
Platform | Status | Features |
---|---|---|
Amazon | β Full Support | Price, availability, product name |
Flipkart | β Full Support | Price, availability, product name |
Generic Sites | β Basic Support | Pattern-based price extraction |
CREATE TABLE products (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
url TEXT UNIQUE NOT NULL,
target_price REAL,
current_price REAL,
last_checked TIMESTAMP,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
active BOOLEAN DEFAULT 1
);
CREATE TABLE price_history (
id INTEGER PRIMARY KEY,
product_id INTEGER,
price REAL NOT NULL,
availability BOOLEAN,
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (product_id) REFERENCES products (id)
);
Start the FastAPI server:
python price_monitor_api.py
Method | Endpoint | Description |
---|---|---|
GET |
/products |
List all monitored products |
POST |
/products |
Add new product to monitor |
GET |
/products/{id} |
Get specific product details |
PUT |
/products/{id} |
Update product settings |
DELETE |
/products/{id} |
Remove product from monitoring |
POST |
/check-prices |
Trigger price check |
GET |
/products/{id}/history |
Get price history |
GET |
/alerts |
Get recent alerts |
import requests
# Add a product via API
response = requests.post("http://localhost:8000/products", json={
"name": "MacBook Pro 16\"",
"url": "https://amazon.com/dp/B09JQKBQSB",
"target_price": 2299.00
})
product = response.json()
# Get price history
history = requests.get(f"http://localhost:8000/products/{product['id']}/history")
# Excel report with multiple sheets
excel_file = monitor.generate_excel_report()
# CSV export
csv_files = monitor.export_to_csv(export_type="all")
# Price charts
chart_file = monitor.generate_price_chart(product_id, days=30)
The system generates professional charts showing:
- Price trends over time
- Minimum, maximum, and current prices
- Target price indicators
- Availability status
Set up email alerts for price changes:
from price_monitor_system import EmailNotifier
# Configure email
notifier = EmailNotifier()
notifier.setup_email(
email="your-email@gmail.com",
password="your-app-password", # Use Gmail App Password
recipients=["alert@yourdomain.com"]
)
# Automatic alerts are sent when:
# - Price drops by 5% or more
# - Target price is reached
# - Product comes back in stock
# Optional: PostgreSQL connection
DATABASE_URL=postgresql://user:password@localhost/pricedb
# Email configuration
SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
- Scraping Intervals: Modify
setup_scheduler()
function - Alert Thresholds: Adjust percentage triggers in
check_single_product()
- User Agent Rotation: Add more user agents in
__init__()
- Site Support: Extend scraping methods for new e-commerce sites
- Connection Pooling: Reuse HTTP connections for better performance
- Rate Limiting: Respectful delays to avoid being blocked
- Database Indexing: Optimized queries for large datasets
- Async Support: FastAPI endpoints for concurrent operations
- SQLite: Up to 1,000 products for personal use
- PostgreSQL: Unlimited products for enterprise use
- Scraping Frequency: Maximum once per hour per product
- Concurrent Checks: 5-10 products simultaneously
- Custom Price Monitoring: $200-500 per project
- E-commerce Integration: $500-1000 per implementation
- Data Analysis Services: $30-80 per hour
- Recurring Monitoring: $50-150 monthly per client
- White-label solutions for retailers
- API integration for inventory management
- Custom alert systems for procurement teams
- Competitive pricing intelligence
Run the test suite:
# Basic functionality test
python -m pytest tests/
# Run demo with sample data
python price_monitor_system.py
- β Database operations
- β Web scraping functionality
- β Price change detection
- β Alert generation
- β API endpoints
- β Export functionality
- Respectful request rates (2-5 second delays)
- User agent rotation to minimize server load
- Error handling to avoid infinite retry loops
- Compliance with robots.txt when applicable
- Local database storage by default
- No data collection or external transmission
- Secure email credential handling
- Optional encryption for sensitive data
python price_monitor_system.py
# Using Gunicorn for API
gunicorn price_monitor_api:app -w 4 -k uvicorn.workers.UvicornWorker
# With Docker
docker build -t price-monitor .
docker run -p 8000:8000 price-monitor
- Heroku: Deploy with PostgreSQL addon
- DigitalOcean: Use App Platform for easy scaling
- AWS: Lambda functions for serverless monitoring
- Railway: Simple deployment with managed databases
price-monitor-system/
βββ price_monitor_system.py # Core monitoring system
βββ price_monitor_api.py # FastAPI REST API
βββ requirements.txt # Python dependencies
βββ README.md # This documentation
βββ tests/ # Test files
βββ examples/ # Usage examples
βββ docs/ # Additional documentation
βββ scripts/ # Utility scripts
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow PEP 8 style guidelines
- Add tests for new features
- Update documentation for API changes
- Use meaningful commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- BeautifulSoup: For HTML parsing capabilities
- Requests: For reliable HTTP requests
- FastAPI: For modern API development
- Matplotlib: For beautiful data visualizations
- SQLite/PostgreSQL: For robust data storage
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Developer: Aniket Kumar (DevAniketIT)
- Email: aniket.kumar.devpro@gmail.com
- Machine learning price prediction
- Mobile app companion
- Webhook integrations
- Advanced analytics dashboard
- Multi-language support
- Cryptocurrency price tracking
Built with β€οΈ by Aniket Kumar - Turning ideas into scalable solutions
Developer: Aniket Kumar (DevAniketIT) - A passionate Python developer specializing in automation, web scraping, and enterprise solutions.
This project demonstrates professional Python development practices and showcases advanced skills in system architecture, API development, and business automation.