Web Scraping in general8 min read  ·  Published: 05/06/2026

Building a price monitoring tool with Python and a scraping API lets you automatically track product prices across any e-commerce website, get instant alerts when prices drop, and make smarter purchasing or business decisions without ever opening a browser manually.

1. Why build a price monitoring tool?

Price monitoring is one of the most practical applications of web scraping. Whether you are a developer building a competitive intelligence tool, a business tracking competitor pricing, or simply a consumer waiting for a deal, automating price checks saves time and ensures you never miss an opportunity.

Instead of manually visiting dozens of product pages every day, a price monitoring tool does the work for you. It records historical prices, detects changes, and triggers notifications in the background. Moreover, with a reliable scraping API, you avoid the usual headaches of bot detection, IP bans, and JavaScript rendering.

2. How a price monitoring tool works

At its core, a price monitoring tool follows a simple loop:

  1. Fetch the product page HTML using a scraping API.
  2. Parse the price from the HTML response.
  3. Store the price with a timestamp in a local database or CSV file.
  4. Compare the new price with the previous recorded price.
  5. Send an alert if the price has dropped below a defined threshold.
  6. Wait a set interval, then repeat.

Each step is straightforward in Python. However, the most critical part is step 1: reliably fetching the page. E-commerce websites like Amazon, eBay, or Temu actively block scrapers. Therefore, using a scraping API such as ScrapingBot handles proxy rotation, browser rendering, and anti-bot bypass automatically.

3. Setting up your Python environment

First, install the required libraries. You only need a few standard packages to get started:

pip install requests beautifulsoup4

Then create your project structure:

price-monitor/
├── monitor.py        # main script
├── prices.csv        # price history
└── config.py         # API key and settings

In config.py, define your ScrapingBot API credentials and monitoring settings:

API_USER = 'your_scrapingbot_username'
API_KEY  = 'your_scrapingbot_api_key'
ALERT_EMAIL = 'you@example.com'
CHECK_INTERVAL = 3600  # seconds between checks (1 hour)

4. Fetching prices with a scraping API

Using ScrapingBot's API, fetching a product page is as simple as one HTTP request. The API returns the fully rendered HTML, even for JavaScript-heavy pages. As a result, you can parse the price directly without dealing with Selenium or Playwright.

import requests
from bs4 import BeautifulSoup
import config

def fetch_price(product_url):
    api_url = 'https://api.scraping-bot.io/scrape/raw-html'
    params = {'url': product_url, 'renderJs': 'true'}
    response = requests.get(
        api_url,
        params=params,
        auth=(config.API_USER, config.API_KEY),
        timeout=60
    )
    response.raise_for_status()
    soup = BeautifulSoup(response.text, 'html.parser')
    # Example for Amazon — adjust selector for your target site
    price_tag = soup.select_one('span.a-price .a-offscreen')
    if price_tag:
        raw = price_tag.get_text(strip=True)
        return float(raw.replace('$', '').replace(',', ''))
    return None

The CSS selector span.a-price .a-offscreen targets Amazon's price element. For other websites, simply inspect the page and update the selector accordingly. In addition, ScrapingBot's retail scraper endpoint can return structured JSON directly for supported e-commerce sites, removing the need to parse HTML at all.

5. Storing and comparing prices

A simple CSV file is sufficient for most use cases. It keeps things lightweight and easy to inspect. However, if you plan to monitor dozens of products over time, consider switching to SQLite for more robust querying.

import csv, os
from datetime import datetime

CSV_FILE = 'prices.csv'

def save_price(url, price):
    file_exists = os.path.isfile(CSV_FILE)
    with open(CSV_FILE, 'a', newline='') as f:
        writer = csv.writer(f)
        if not file_exists:
            writer.writerow(['timestamp', 'url', 'price'])
        writer.writerow([datetime.now().isoformat(), url, price])

def get_last_price(url):
    if not os.path.isfile(CSV_FILE):
        return None
    with open(CSV_FILE, 'r') as f:
        rows = [r for r in csv.DictReader(f) if r['url'] == url]
    return float(rows[-2]['price']) if len(rows) >= 2 else None

This approach appends a new row each time you check the price, giving you a full price history over time. Furthermore, you can later visualize this data as a chart to identify pricing trends.

6. Sending price drop alerts

When the price drops, you want to know immediately. The simplest solution is an email alert via Python's built-in smtplib. For example, you can use a Gmail account with an app password:

import smtplib
from email.mime.text import MIMEText
import config

def send_alert(url, old_price, new_price):
    subject = f'Price drop: ${new_price:.2f} (was ${old_price:.2f})'
    body = f'Price drop detected for:
{url}
New: ${new_price:.2f} / Old: ${old_price:.2f}'
    msg = MIMEText(body)
    msg['Subject'] = subject
    msg['From'] = config.ALERT_EMAIL
    msg['To'] = config.ALERT_EMAIL
    with smtplib.SMTP_SSL('smtp.gmail.com', 465) as server:
        server.login(config.ALERT_EMAIL, config.GMAIL_APP_PASSWORD)
        server.send_message(msg)

Alternatively, you can send alerts via Slack, Telegram, or a webhook. Instead of smtplib, simply replace the delivery method with the relevant API call. The logic remains exactly the same.

7. Automating the monitoring loop

Now, bring everything together in a main loop. The script checks each product at regular intervals and sends an alert only when the price drops below a configurable threshold:

import time, config
from scraper import fetch_price
from storage import save_price, get_last_price
from alerts import send_alert

PRODUCTS = [
    'https://www.amazon.com/dp/B09EXAMPLE1',
    'https://www.amazon.com/dp/B09EXAMPLE2',
]

THRESHOLD = 0.95  # alert if new price is 5% below previous

def monitor():
    while True:
        for url in PRODUCTS:
            price = fetch_price(url)
            if price is None:
                continue
            last = get_last_price(url)
            save_price(url, price)
            if last and price <= last * THRESHOLD:
                send_alert(url, last, price)
        time.sleep(config.CHECK_INTERVAL)

if __name__ == '__main__':
    monitor()

To run this continuously in the background, use a tool like screen or tmux on Linux. In addition, you can deploy it to a cloud VM or a service like Railway for 24/7 monitoring without keeping your laptop on.

8. ScrapingBot features useful for price monitoring

ScrapingBot offers several features that make it particularly well-suited for price monitoring at scale. The table below summarises the most relevant ones:

FeatureBenefit for price monitoring
Automatic proxy rotationAvoids IP bans on repeated checks of the same product page
JavaScript renderingHandles dynamic prices loaded via React or Vue
Retail scraper endpointReturns structured JSON (price, title, images) for major e-commerce sites
Residential proxiesMimics real user traffic for sites with strict bot detection
High uptime SLAEnsures your monitoring loop never fails due to API downtime

9. Going further

This price monitoring tool with Python covers the essentials, but there is plenty of room to expand. For instance, you could add a small web dashboard to visualize price history as a chart, support multiple currencies, or sync results to a Google Sheets spreadsheet for non-technical teammates.

You could also extend the scraper to monitor stock availability alongside price, which is useful for limited-edition products. Finally, combining this project with ScrapingBot's Price Scraping API will give you an even deeper understanding of how to extract and exploit pricing data at scale.