Introduction
Imagine the fuss and excitement of November Black Friday offers? Especially as a student trying to convince somebody to buy you the item? (I hope you get it). That’s exactly what pushed me to work on this small but super practical task.
In this little project, I decided to track the price of a HP Envy X360 on Jumia, a popular ecommerce platform here in Kenya. Not because I want it for myself, if I’m being honest, I’d be going for an Alienware. Problem is... I can’t afford it (yet).
So, the goal:
- Build a Python script that scrapes the laptop’s product page on Jumia to check for price drops.
- If the price drops below my target, which is Ksh 80,000, the script sends me an email notification.
- To automate the process, the script runs every hour using Windows Task Scheduler, so no need to keep checking manually.
Python Script
The script is simple: it fetches the HTML of the Jumia page, parses the price from the span element, checks if it’s below a set threshold, and emails me if it is.
I’m using environment variables to store my Gmail app password and recipient email address - because yeah, passwords in code are a bad idea (even though this is a small personal script).
This is the inspected HMLT for the page:


Here’s a quick idea of what it does:
# If price < 80000:
# Send me an email saying, “Order now!!”
It doesn’t get fancier than that. And that’s okay because it works.
import requests
from bs4 import BeautifulSoup
import re
import smtplib
import os
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# Jumia product page
url = "https://www.jumia.co.ke/hp-envy-x360-2-in-1-laptop-core-5-120u-8gb-ram-512gb-ssd-14-fhd-touchscreen-display-fingerprint-reader-natural-silver.html"
# target price
my_price = 80000
# email setup
my_email = os.environ.get("ABR_EMAIL")
my_password = os.environ.get("GMAIL_APP_PASSWORD")
send_to = os.environ.get("MM_EMAIL")
headers = {
"User-Agent": "Mozilla/5.0"
}
res = requests.get(url, headers=headers)
soup = BeautifulSoup(res.content, "html.parser")
# find the price
price_tag = soup.find("span", class_="-b -ubpt -tal -fs24 -prxs")
if price_tag:
price_text = price_tag.get_text().strip()
price_clean = int(re.sub(r"[^\d]", "", price_text))
print("The price right now is: KSh", price_clean)
if price_clean < my_price:
print("Price is below 80,000! Sending email...")
subject = "HP Envy X360 New Price Alert!"
body = "The price for HP Envy X360 is below 80,000 on Jumia. Order now!!\n\nAbraham."
msg = MIMEMultipart()
msg["From"] = my_email
msg["To"] = send_to
msg["Subject"] = subject
msg.attach(MIMEText(body, "plain"))
try:
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(my_email, my_password)
server.send_message(msg)
server.quit()
print("Email was sent!")
except Exception as e:
print("Mail error:", e)
else:
print("Pg not found.")
Task Scheduling on Windows
I used Windows Task Scheduler (yes, it exists, and it works beautifully).
Here’s what I did:
- Search for Task Scheduler.
- Click Create Task (not “Basic Task”, we need full control).
- Under the General tab:
- Give it a name like "HP-Envy".
- Check “Run whether user is logged on or not”.
- Check “Run with highest privileges”.
- Under Triggers:
- Set the start date to November 8th (Black Friday).
- Repeat every 1 hour for 1 day.
- Under Actions:
Program/Script: path to your Python interpreter:
C:\Users\Abraham\AppData\Local\Programs\Python\Python370\python.exe
Add arguments: path to your script:
C:\Users\Abraham\.vscode\HP-Envy.py
- Under Conditions:
- Uncheck “Start the task only if the computer is on AC power”. My laptop doesn’t need to be plugged in. If it has charge, it runs.
- Under Settings:
- Allow it to run as needed.
- But if it ever runs longer than an hour (which it shouldn’t), let it give up.
Final Schedule Summary
- Runs hourly
- Only on November 8th - Black Friday
- Works even when the laptop is idle or locked
- Doesn’t need to be plugged in
- Automatically sends email if the price drops below KSh 80,000
Conclusion
This was a fun, quick project that combines:
- Basic web scraping
- A bit of email automation
- Little touch of Windows automation
Is it the most elegant solution? Nope.
Does it work and save me time and money? Yes.