DigitalOcean Referral Badge
Udit Vashisht
Author: Udit Vashisht

Get an automated email on availability of Covishield and Covaxin on Cowin

  • 4 minutes read
Get an automated email on availability of Covishield and Covaxin on Cowin

    Table of Contents

How to get an automated email on availability of Covishield and Covaxin on Cowin website?

I have created a Python Script which can be used to send automated email if the COVID-19 Vaccine (Covishield or Covaxin) is available on the Indian Government’s Cowin Portal for any age group (18 + or 45+). This script has been built by using the API provided by the Government.

You can either run this script locally on your computer or on a Raspberry PI or can host your script on Digital Ocean.


  • A gmail account and password.
  • An app password if you have 2-Step Verification enabled on your gmail account. Follow this link to learn to setup your account.

Note: You can also use other email accounts but for that you will have to change email server and PORT at line 66 of the code (


  • Python 3.6 or above (As the code uses f-strings)
  • cowin (pip install cowin)
  • pandas

You can use the following command to install all the requisite modules:-
pip install -r requirements.txt


Either download the directory from github or clone it using:-

cd cowin-gmail-alerts
python3 -m venv . #You can use python or python3 or python3.6 depending on your system
source bin/activate
pip install -r requirements.txt


Adding your email credentials

You can add the FROM_EMAIL, TO_EMAIL, PASSWORD (for FROM_EMAIL) either at line 11-13 of the python code ( or
your can use python-decouple or environment variables

TO_EMAIL = config('TO_EMAIL')

Create a .env file and add your credentials


Then you need to provide the following:-

  1. No. of Days :- It should be added in line 16 of the code. Preferably 7,14,21 or 28 days should be added if add between 14 to 20 days it will give data for 14 days.

  2. Pincodes :- You can add any number of pincodes in line 17. But the pincodes should be added as string separted by commas in a list. e.g [‘141001’, ‘152002’, ‘152001’]

  3. Age :- To be added in line 18 of the code. Acceptable values are 18 or 45.

# Just Change these values
no_of_days = 28   # Change this to 7,14,21 or 28
pincodes = ['141001', '141002']  # Add as many pincodes as you want separated by commas
min_age_limit = 18  # Change this to 18 if you want 18+

Then the script can be run as


Your will get an email like this :-


You can either schedule to run the script at regular intervals or run it in the background after commenting out line 132 and uncommenting lines 136-138 of the code. It will run the script and check for the availability after every 15 minutes till you keep it running.

if __name__ == '__main__':

    main()  # comment this

    # If you want to continuosly run it in background comment the above line and uncomment the following lines and the function will be repeated after every 15 minutes

    # while True:
    #     main()
    #     time.sleep(900)

Note:- You might change the name in the message at line 63 and the subject at line 57

    message['Subject'] = 'Covid Vaccination Slot is available'
    message['From'] = FROM_EMAIL
    message['To'] = TO_EMAIL
    with open(text_file, 'r') as f:
        contents = f.readlines()
        text = '\n'.join(contents)
        final_text = f'Dear Udit,\n\n Covid Vaccination slots are available at the following locations\n {text} \n\nRegards,\n Udit'

Ways to Support Us

If you have liked this post, there are few ways in which you can support us:-

You can join and contribute on Patreon or you can contribute through Paypal

In addition to that you can show your support by following our social accounts or by simply sharing this post.
1. Facebook
2. Twitter
3. Instagram
4. Youtube

Related Posts

New Walrus Operator in Python 3.8
By Udit Vashisht

What is new walrus operator in Python 3.8?

The official version of Python 3.8 was released in October, 2019.

What’s new in Python 3.8?

Before going in details about new Walrus Operator in Python 3.8, I will like to summarize what is new in Python 3.8 :-

Read More
How to use Python to download Historical Data of NSE Stocks?
By Udit Vashisht

Stop manually downloading the historical data of NSE stocks, use Python instead

If you are manually downloading the historical or daily data for the stocks from NSE, you should stop doing that and start using Python to do the same. There are many benefits of using Python to download historical ...

Read More
Download Latest NIFTY 50 Stocks List 2022 using Two Lines of Python Code
By Udit Vashisht

How to download latest NIFTY 50 Stocks List 2022 using just two lines of Python Code?

In this tutorial, we will use python to download the latest NIFTY 50 stocks. We will be using the official NSE website to source the link to the CSV File. Hence, this method will ...

Read More
tech tutorials automate python beautifulsoup web scrapping webscrapping bs4 Strip Python3 programming Pythonanywhere free Online Hosting hindi til github today i learned Windows Installations Installation Learn Python in Hindi Python Tutorials Beginners macos installation guide linux SaralGyaan Saral Gyaan json in python JSON to CSV Convert json to csv python in hindi convert json csv in python remove background python mini projects background removal tweepy Django Django tutorials Django for beginners Django Free tutorials Proxy Models User Models AbstractUser UserModel convert json to csv python json to csv python Variables Python cheats Quick tips == and is f string in python f-strings pep-498 formatting in python python f string smtplib python send email with attachment python send email automated emails python python send email gmail automated email sending passwords secrets environment variables if name == main Matplotlib tutorial Matplotlib lists pandas Scatter Plot Time Series Data Live plots Matplotlib Subplots Matplotlib Candlesticks plots Tutorial Logging unittest testing python test Object Oriented Programming Python OOP Database Database Migration Python 3.8 Walrus Operator Data Analysis Pandas Dataframe Pandas Series Dataframe index pandas index python pandas tutorial python pandas python pandas dataframe python f-strings padding how to flatten a nested json nested json to csv json to csv python pandas Pandas Tutorial insert rows pandas pandas append list line charts line plots in python Django proxy user model django custom user model django user model matplotlib marker size pytplot legends scatter plot python pandas python virtual environment virtualenv venv python python venv virtual environment in python python decorators bioinformatics fastafiles Fasta python list append append raspberry pi editor cron crontab Cowin Cowin api python dictionary Python basics dictionary python list list ios development listview navigationview swiftui ios mvvm swift environmentobject property wrapper @State @Environm popup @State ios15 alert automation instagram instaloader texteditor youtubeshorts textfield multi-line star rating reusable swift selenium selenium driver requests-html youtube youtube shorts python automation python tutorial algo trading nifty 50 nifty50 stock list nifty50 telegram telegram bot dictionary in Python how to learn python learn python