Skip to content

dilansalinda/IRD-News-Notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

IRD News Notifier

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.

Features

  • Scrapes the official IRD English news page: IRD News and Notices
  • English, Sinhala and Tamil Language notification can be configuer.
  • Parses HTML to find the title, description, link, and publication date of each notice.
  • Filters for news items published on the current date.
  • Sends a single email alert containing all of today's new items.
  • Uses smtplib to send email via a Google (Gmail) account.

Prerequisites

  • Python 3.7+
  • A Google (Gmail) account to send emails from.
  • A Google App Password for the sender's email account.
    • Note: Your regular Gmail password will not work due to Google's security policies. You must generate an "App Password" to allow the script to log in.
    • See: How to generate a Google App Password

Setup

  1. Clone the Repository

    git clone https://github.com/dilansalinda/IRD-News-Notifier.git
    
    cd IRD-News-Notifier
  2. Create a Virtual Environment (Recommended)

    python -m venv venv
    source venv/bin/activate 
    # On Windows: venv\Scripts\activate
  3. Install Dependencies Create a requirements.txt file (as shown above) in the project directory and run:

    pip install -r requirements.txt
  4. 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.
    • BASE_URL: Base URL of IRD Sri Lanka.
    • PATH: Path for IRD Sri Lanka web news and notices page.
    • LANGUAGE: News and Notices language.

    On Linux/macOS:

    export SENDER_EMAIL="your-email@gmail.com"
    export APP_PASSWORD="your-16-char-app-password"
    export RECEIVER_EMAIL="recipient@example.com"
    export BASE_URL = "https://www.ird.gov.lk" //this should be update
    export PATH = "sitepages/News and Notices.aspx" //this should be update
    export LANGUAGE = "en" or "si" or "ti"

    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"
    set BASE_URL = "https://www.ird.gov.lk" //this should be update
    set PATH = "sitepages/News and Notices.aspx" //this should be update
    set LANGUAGE = "en" or "si" or "ti"

Usage

Once your environment variables are set and dependencies are installed, just run the script:

python ird_news_notifier.py

About

πŸ‡±πŸ‡° A Python script that monitors the Sri Lankan Inland Revenue Department (IRD) news page and sends email alerts for new announcements.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages