Skip to content

Luffy610/amul-stock-watcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧀 AMUL Stock Watcher (with Email Alerts)

This Python project monitors the availability of selected AMUL products on the AMUL website and notifies you via email when a product is back in stock.

Perfect for when you're trying to buy a high-demand item like protein milk, buttermilk and whey protein and it's often marked "Sold Out".

✨ Features

  • ✅ Headless stock checker using Selenium
  • ✅ Fully automated via GitHub Actions (runs every 4 hours)
  • 📩 Sends email notifications when a product becomes available
  • 🔁 Retries up to 3 times if the website fails to load properly
  • 🔐 Uses GitHub Secrets for safe storage of credentials
  • 📱 Supports multiple email recipients

📦 Project Structure

amul-stock-watcher/
├── app/
│   ├── send_email.py        # Email notification logic
│   ├── stock_checker.py     # Stock checking logic
│   └── main.py              # Main checker script
├── requirements.txt         # Python dependencies
└── .github/
    └── workflows/
        └── stock-check.yml  # GitHub Actions workflow

🚀 How It Works

  1. Selenium opens the AMUL product page.
  2. Enters your pincode via the popup modal.
  3. Waits for page update and checks for "Sold Out" alert.
  4. If not sold out, it sends an email alert with the product URL.
  5. GitHub Actions runs this script every 4 hours.

🧑‍💻 Local Setup

1. Clone the Repo

git clone https://github.com/yourusername/amul-stock-watcher.git
cd amul-stock-watcher

2. Install Dependencies

pip install -r requirements.txt
  1. Add a .env file (for local testing) Create a file named .env with the following content:
[email protected]
GMAIL_PASS=your_16_char_app_password
[email protected],[email protected]

4. Run the Script

python app/main.py

You'll see the logs and recieve an email if the product is in stock.

☁️ GitHub Actions Setup (Automatic Checks Every 4 Hours)

1. Add Repository Secrets

Go to your repo > Settings > Secrets and variables > Actions, and add these:

Secret Name Description
GMAIL_USER Your Gmail address
GMAIL_PASS Your Gmail app password (16 characters)
EMAIL_TO Comma-separated list of recipient emails

2. Push the Code

Ensure your repo contains:

- app/
  - send_email.py
  - stock_checker.py
  - main.py
- requirements.txt
- .github/
  - workflows/
    - stock-check.yml
- .env (optional for local testing)
git add .
git commit -m "Setup AMUL Stock Watcher"
git push origin main

3. Run it manually (optional)

You can manually trigger the workflow from the GitHub Actions tab in your repo.

⏰ Scheduled Cron Timing

The script runs every 4 hours using the following cron expression:

on:
  schedule:
    - cron: '0 */4 * * *'

This means it will check the stock at 00:00, 04:00, 08:00, 12:00, 16:00, and 20:00 UTC.

📧 Multiple Email Recipients

You can specify multiple email addresses in the EMAIL_TO variable, separated by commas. The script will send notifications to all listed recipients.

💻 Tech Stack

  • Python 3.13
  • Selenium for web automation
  • Gmail for email notifications
  • GitHub Actions for automation
  • Tested headlessly on Ubuntu 22.04 via GitHub Actions

⚠️ Notes

  • Make sure to use a Gmail app password for the GMAIL_PASS variable. Regular Gmail passwords won't work due to security restrictions. Generate one here.
  • If you're using a different email provider, update the SMTP server accordingly
  • This project scrapes AMUL’s publicly available product stock status; use respectfully

🙌 Contributing

Pull requests are welcome! Open an issue if you want to monitor multiple URLs, switch to Pushbullet/Telegram, or add logging features.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages