HyTrackV3
HyTrackV3 is an automated shipment tracker. It watches a mailbox over IMAP, picks out Blue Dart and Delhivery waybill numbers, checks each one with Requests, BeautifulSoup and headless Chrome, and emails you a styled update whenever a shipment’s status changes.
Try It Now
You can use the hosted instance to track your packages straight away.
Email your Blue Dart or Delhivery tracking numbers (waybills) to:
HyTrack picks up the waybills, starts watching each package, and emails you whenever its status changes. Reply to any update with another waybill to track that one too.
The Update Email
Every update leads with the status and the latest scan, then the route, the expected delivery date, and a journey log of recent scans. Statuses fall into four groups, each with its own badge, and every message carries a plain-text version for clients that don’t render HTML. The design matches this site’s ivory theme, with every colour inlined so it survives email clients that strip styles.




On a Phone
Below 520 pixels the timestamp moves above each scan, the route and delivery date stack, and the card tightens up, so the journey log stays readable on a phone.




Features
Inbox-Driven Tracking
Connects to a mailbox over IMAP and reads waybill numbers from the subject and body of new mail, so tracking a parcel is as simple as forwarding the shipping email.
Blue Dart and Delhivery
Blue Dart is fetched with Requests and BeautifulSoup over a retrying session. Delhivery’s dynamic tracking page is read with Selenium in headless Chrome, including the scan history.
Careful Ingestion
Skips numbers that look like phone numbers, ignores bounces, auto-replies and mail that fails SPF, DKIM or DMARC, and caps waybills per email and active shipments per sender.
Status-Aware
Each courier scan is sorted into in transit, out for delivery, delivered or needs attention, so a failed attempt or a return is flagged rather than buried in courier jargon.
Journey Log Emails
Updates show the route, expected delivery and the eight latest scans, in HTML with a plain-text fallback. A send that fails is retried on the next run.
Self-Maintaining
A local SQLite database records every shipment and the last event seen. Delivered parcels stop being checked, and waybills that never resolve or stop changing are retired.
Cron-Friendly
Each run is a single pass that’s safe to schedule: a lock makes an overlapping run exit straight away, and the log file rotates on its own.
Tested in CI
Unit tests cover parsing, classification, ingestion and the email builder, and run on Python 3.12, 3.13 and 3.14 in GitHub Actions alongside CodeQL scanning.
How It Works
- Read the inbox. Each run fetches unseen mail over IMAP and pulls out waybill numbers, matching each one to its courier.
- Check the courier. Every active shipment’s latest scan and history are fetched from Blue Dart or Delhivery.
- Compare. The latest event is hashed and compared with the last one stored in SQLite, so only real changes count.
- Notify. On a change, HyTrack sends the update email over SMTP to whoever sent in the waybill.
- Tidy up. Delivered shipments stop being checked, and stale ones expire after a configurable number of days.
Prerequisites
Before running HyTrackV3 yourself, make sure you have:
- Python 3.10+
- Google Chrome (latest stable version)
- Git
Installation
-
Clone the repository:
git clone https://github.com/nicx17/HyTrackV3.git cd HyTrackV3 -
Set up a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate -
Install dependencies:
pip install -r requirements.txtThis installs
selenium,beautifulsoup4,requests,webdriver-managerand the other required packages.
Configuration
HyTrackV3 reads its settings from environment variables.
-
Copy the sample configuration:
cp sample.env.txt .env -
Edit
.envwith your mail accounts, then adjust the limits if you like:# Email IMAP configuration (for fetching tracking numbers) IMAP_SERVER="imap.gmail.com" IMAP_PORT=993 EMAIL_ADDRESS="your_email@example.com" EMAIL_PASSWORD="your_app_specific_password" # Email SMTP configuration (for sending status updates) SMTP_SERVER="smtp.gmail.com" SMTP_PORT=587 RECIPIENT_EMAIL="notify_me@example.com" # Logging level and rotation LOG_LEVEL="INFO" LOG_MAX_BYTES=5242880 LOG_BACKUP_COUNT=3 # Abuse limits for the intake mailbox MAX_WAYBILLS_PER_EMAIL=10 MAX_ACTIVE_PER_SENDER=25 # Stop tracking waybills that never resolve, or stop changing (days) UNFOUND_EXPIRY_DAYS=7 IDLE_EXPIRY_DAYS=30Note for Gmail users: you must use an App Password if 2-Step Verification is enabled. See the Configuration Guide for step-by-step instructions, and the Troubleshooting Guide if something doesn’t connect.
Usage
Run the tracker manually:
python Hytrack3.py
Automation (Cron Job)
To run the tracker on a schedule (every hour, for example), add a cron job:
crontab -e
Add the following line, adjusting the paths:
0 * * * * /path/to/HyTrackV3/.venv/bin/python /path/to/HyTrackV3/Hytrack3.py >> /path/to/HyTrackV3/cron.log 2>&1
A run that starts while the previous one is still going exits straight away, so overlapping cron runs are safe.
Project Structure
HyTrackV3/
├── .github/workflows/ # Tests (Python 3.12–3.14) and CodeQL
├── assets/ # README screenshots
├── docs/ # Configuration and troubleshooting guides
├── tests/ # Unit tests
├── Hytrack3.py # Main application script
├── requirements.txt # Python dependencies
├── sample.env.txt # Template for environment variables
├── README.md # Project documentation
└── hytrack3.db # SQLite database (created on first run)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
Distributed under the GPL-3.0 License. See LICENSE for more information.