This Python script automatically scrapes the Sri Lankan Inland Revenue Department (IRD) “News and Notices” page. If it finds any new announcements published on the current day, it sends a consolidated email notification to a specified recipient using Gmail.
This is ideal for running as a daily automated task (e.g., a cron job) to stay updated on new tax circulars, notices, and publications.
https://www.ird.gov.lk/en/sitepages/News%20and%20Notices.aspxsmtplib to send email via a Google (Gmail) account.git clone [https://github.com/your-username/ird-annulments-tracker.git](https://github.com/your-username/ird-annulments-tracker.git)
cd ird-annulments-tracker
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
requirements.txt file (as shown above) in the project directory and run:
pip install -r requirements.txt
Set Environment Variables The script requires three environment variables to function. You must set these in your environment before running the script.
SENDER_EMAIL: The Gmail address the email will be sent from (e.g., my-notifier@gmail.com).APP_PASSWORD: The 16-character Google App Password you generated.RECEIVER_EMAIL: The email address where you want to receive the alerts.On Linux/macOS:
export SENDER_EMAIL="your-email@gmail.com"
export APP_PASSWORD="your-16-char-app-password"
export RECEIVER_EMAIL="recipient@example.com"
On Windows (Command Prompt):
set SENDER_EMAIL="your-email@gmail.com"
set APP_PASSWORD="your-16-char-app-password"
set RECEIVER_EMAIL="recipient@example.com"
Once your environment variables are set and dependencies are installed, just run the script:
```bash python ird_news_notifier.py