A simple Python script to monitor available vaccine appointment slots for a specific district using the CoWIN public API.
This script helps users find available vaccine slots that meet their criteria (age and minimum doses) without manually checking the CoWIN website repeatedly. It runs in the background and prints notifications to the console when slots are found.
- Fetches real-time data from the CoWIN API.
- Filters slots based on minimum age and available dose capacity.
- Checks for slots at a configurable interval.
- Prints available slots details to the console.
- Python 3.x
- The
requestsPython library
- Make sure you have Python 3.x installed. You can download it from python.org.
- Install the
requestslibrary using pip:pip install requests
Open the vaccine_checker.py file (or whatever you name the script) in a text editor. Modify the following variables in the # CONFIGURATION section:
DISTRICT_ID: Replace194with the numerical ID of your desired district. You can find district IDs from various online sources or by exploring the CoWIN API documentation if you are technically inclined.CHECK_INTERVAL: The time in seconds between checks (default is 60 seconds).AGE_LIMIT: Set to18or45based on the age group you are looking for.MIN_DOSES: The minimum number of available doses required at a center to trigger an alert (default is 1).
- Save the code as a Python file (e.g.,
vaccine_checker.py). - Open a terminal or command prompt.
- Navigate to the directory where you saved the file.
- Run the script using the command:
python vaccine_checker.py
- The script will start checking for slots and print updates to the console. It will notify you with "🚨 Slots available!" when it finds centers matching your criteria.
- The script checks for slots for the current date only.
- The script will run continuously until you stop it by pressing
Ctrl+Cin the terminal. - Be mindful of the
CHECK_INTERVAL. Checking too frequently might put unnecessary load on the CoWIN API. - This script is a basic tool. For more advanced features (like notifications via email/SMS, checking multiple dates/districts), you would need to enhance the code.
- Ensure you comply with the CoWIN API usage policy.
This script is provided for informational purposes only. The availability of vaccine slots is subject to real-time updates on the CoWIN platform.
- Uses the CoWIN public API.
- Developed in Python.