Back to Projects

PYTHON AUTOMATION

Amazon Price Tracker

A Python automation tool that monitors product prices in real-time and sends instant email alerts when deals go live.

Web Scraping SMTP Automation Pandas BeautifulSoup

Project Overview

This project is designed for smart shoppers and data enthusiasts. By employing Web Scraping techniques, the script periodically checks a specific Amazon product page, extracts the current price, and logs the data. If the price drops below a user-defined threshold, it triggers an SMTP email notification, ensuring you never miss a bargain.

Price Monitoring

Scrapes live pricing data directly from Amazon product pages.

Email Alerts

Sends instant notifications via Gmail when target prices are met.

Data Logging

Maintains a constant CSV history of price fluctuations over time.

Scheduled Runs

Runs automatically at set intervals (e.g., every 24 hours).

Core Implementation

1. Scraping Product Data

We use requests to fetch the page and BeautifulSoup to parse the HTML, extracting the specific title and price elements.

amazon_tracker.py
def check_price():
    URL = 'https://a.co/d/5i5wfE2'
    headers = {"User-Agent": "Mozilla/5.0..."}
    
    page = requests.get(URL, headers=headers)
    soup = BeautifulSoup(page.content, "html.parser")
    
    # Extract title and price
    title = soup.find(id="productTitle").get_text()
    price = soup.find(id="priceblock_ourprice").get_text()
    
    if(price < 15):
        send_mail()

2. Sending Email Notifications

The smtplib library connects to Gmail's SMTP server to send a secure alert when the logic condition (Price < $15) is met.

amazon_tracker.py
def send_mail():
    server = smtplib.SMTP_SSL('smtp.gmail.com', 465)
    server.login('email@gmail.com', 'password')
    
    subject = "The Desk is now less than $15!"
    body = "link: https://a.co/d/5i5wfE2"
    msg = f"Subject: {subject}\n\n{body}"
    
    server.sendmail('from@gmail.com', 'to@gmail.com', msg)
    server.quit()

3. Scheduling the Tracker

A simple while loop coupled with time.sleep() keeps the script running indefinitely, checking prices once a day.

amazon_tracker.py
while(True):
    check_price()
    
    # Check every 24 hours (86400 seconds)
    time.sleep(86400)

Key Outcomes & Conclusion

This project automates the manual task of price checking, providing a practical application of Python scripting. Key takeaways include:

© 2026 Sai Suraj Matta. All rights reserved.