Queries Cowin public API, then sends the details of new slots in your district to your Telegram Channel or Group.
Made with ❤️ using Python 🐍.
Get started with your District ID and Chat ID of your Telegram Channel/Group.
Requires Python 3.9+
Tested working on Windows 10 .
Works only in India (🇮🇳) due to Geofencing of the API.
-
Install Anaconda
-
Use Anaconda to create a virtual environment and Activate it
For detailed steps, see here
pip install requirements.txtUse the following code to get your district ID
import requests
import json
from fake_useragent import UserAgent
Agent = UserAgent()
browser_header = {"User-Agent":Agent.random}
for states in range(1,40):
print("State Code: ",states)
response = requests.get(f"https://cdn-api.co-vin.in/api/v2/admin/location/districts/{states}", headers=browser_header)
json_data = json.loads(response.text)
for state in json_data["districts"]:
print(state["district_id"],'\t', state["district_name"])
print("\n")To set up a new bot, start the conversation with BotFather (@BotFather). BotFather will help us in creating the new bot.
- Search for @botfather in Telegram.
- Start your conversation by pressing the Start button.
- Create the bot by running /newbot command
- Enter the Display Name and User Name for the bot.
- BotFather will send you a message with the token
DISCLAIMER — Keep access token of the bot securely. Anyone with your token can manipulate this bot.
- Create a new Telegram Channel or group (It can be Public/Private)
- Add your bot to the Channel/Group
- Send a sample message to your Channel
- Forward the same to @JsonDumpBot
- Get the ID
DISCLAIMER — I'm not an affiliate and @JsonDumpBot is not my bot.
1. I do not want to use Telegram and view the details of new slots in the Output Screen(Terminal/CMD/Powershell) instead. What to do?
- Uncomment Line 150 in main.py
- Comment Lines 151,152 in main.py
