How dhananjaylab/price-tracker works
Project type and purpose
• This is a small, single‐script Python tool named Price-Tracker.
• Its purpose is to fetch prices for one or more Amazon product pages on a schedule, record or compare them, and notify the user when conditions are met.
File structure
• Top-level items:
– Amazon_Price_Tracker.py (main script containing scraper logic, scheduler and notification routines)
– README.md (very brief; no additional modules or subdirectories)
• No separate “src” or “lib” directories, so all functionality is in one file or imported libraries.
• No explicit tests or configuration files; likely any scheduling is done externally (cron, Task Scheduler) or via in‐script loop.
README for additional insights
• It only names the project “Price-Tracker.”
a. Main components
1. Scheduler (cron job, Windows Task Scheduler, or in-script loop)
2. Price-Tracker Script (Amazon_Price_Tracker.py)
– HTTP Client / Scraper module
– HTML Parser for price extraction
– Data Layer for persisting results (CSV, SQLite, or external DB)
– Notification Module (email, SMS, Slack, etc.)
3. Data Store (CSV file, SQLite database, or other)
4. External Services
– Amazon product pages (data source)
– Notification service (SMTP server, SMS gateway, or Slack API)
b. Relationships and interactions
• Scheduler triggers the Price-Tracker Script at defined intervals.
• Script sends HTTP requests to Amazon, parses the HTML response to extract current price.
• Parsed price data is saved in the Data Store.
• Script evaluates price threshold or change conditions; if triggered, it invokes the Notification Module.
• Notification Module calls an external notification service to deliver alerts.
c. Architectural patterns/design principles
• Single responsibility within modules: separate scraping, parsing, data persistence, and notifications.
• Externalize scheduling to keep the script focused on data retrieval/processing.
• Use a simple data store to track history and avoid re-scraping unchanged sites.
d. Key technologies/libraries
• Python 3.x
• requests or urllib3 for HTTP requests
• BeautifulSoup or lxml for HTML parsing
• sqlite3 or csv module for storage
• smtplib, Twilio, or Slack SDK for notifications
• Cron (Linux) / Task Scheduler (Windows) for scheduling
Elements
– “trigger” from Scheduler to Script
– “HTTP GET” to Amazon
– “write/read” between Script and Data Store
– “send alert” from Script to Notification Service
– Rectangles for internal components (Script, Data Store)
– Clouds for external services