Skip to content

Instantly share code, notes, and snippets.

@kayceesrk
Created May 3, 2021 08:19
Show Gist options
  • Save kayceesrk/acc527d7bd8e2a9fb954c43c0c10b565 to your computer and use it in GitHub Desktop.
Save kayceesrk/acc527d7bd8e2a9fb954c43c0c10b565 to your computer and use it in GitHub Desktop.
# Prints the slots available in Chennai for 18+ vaccination for the next 2
# weeks.
#
# Chennai's district id is 571.
# See https://apisetu.gov.in/public/marketplace/api/cowin#/Metadata%20APIs
import datetime
import requests
import json
day = datetime.date.today()
one_day = datetime.timedelta(days=1)
url = "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/findByDistrict?district_id=571&date="
headers = {"Accept-Language": "en_US", "accept": "application/json"}
for i in range(0, 14):
print ("******** " + day.strftime("%d-%m-%y") + " ********")
resp = requests.get(url + day.strftime("%d-%m-%y"),headers = headers)
data = json.loads (resp.text)
for r in data["sessions"]:
if r["min_age_limit"] == 18:
print(r)
day = day + one_day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment