Package: cowin-tracker
Cowin TrackerPython API wrapper for CoWin, India's digital platform launched by the government to help citizens register themselves
for the vaccination drive by booking an appointment at the nearby vaccination centres.This wrapper is meant to enable folks to build their own versions of a system to lookup for vaccine availablity either
in a district or in a particular pin code.Example:fromCowinApiimportClientAPIcowin=ClientAPI()states=cowin.get_states()print(states)Installpip install cowin-trackerUsageThe wrapper currently covers four endpoints used by the CoWin portal specified below.InitializefromCowinApiimportClientAPIcowin=ClientAPI()Get all the available statesReturns the list of states in which vaccine drive is being conducted. This also returns thestate_idwhich would be
required in the subsequent requests.fromcowin_apiimportCoWinAPIcowin=CoWinAPI()states=cowin.get_states()print(states)Get all the available districtsReturns the list of districts in a particular states in which vaccine drive is being conducted. This also returns
thedistrict_idwhich would be required in the subsequent requests.In this method, you would need to pass thestate_idretrieved from the previous method.fromCowinApiimportClientAPIcowin=ClientAPI()state_id='21'districts=cowin.get_districts(state_id)print(districts)Get all the centers available in a districtUse this method to lookup for centers based on adistrict_id. This method is broader than
searching by pin code as it covers the whole district.In this method, you would need to pass thedistrict_idretrieved from the previous methods. By default, the method
looks-up for slots with today's date. For any other dates pass the date in DD-MM-YYYY format.fromCowinApiimportClientAPIcowin=ClientAPI()district_id='367'date='12-05-2021'# Optional. Takes today's date by defaultmin_age_limit=18# Optional. By default returns centers without filtering by min_age_limitavailable_centers=cowin.get_availability_by_district_id(district_id,date,min_age_limit)print(available_centers)Get all the available centers in a pin codeUse this method to lookup for centers based on apin_codeor a list ofpin_codes. By default, the method looks-up
for slots with today's date. For any other dates pass the date in DD-MM-YYYY format.fromCowinApiimportClientAPIcowin=ClientAPI()pin_code="400080"date='03-05-2021'# Optional. Default value is today's datemin_age_limit=18# Optional. By default returns centers without filtering by min_age_limitavailable_centers=cowin.get_availability_by_pincode(pin_code,date,min_age_limit)print(available_centers)Get all the available centers in a city nameUse this method to lookup for centers based on acity_name. By default, the method looks-up
for slots with today's date. For any other dates pass the date in DD-MM-YYYY format.fromCowinApiimportClientAPIcowin=ClientAPI()city_name="Pune"date='03-05-2021'# Optional. Default value is today's datemin_age_limit=18# Optional. By default returns centers without filtering by min_age_limitavailable_centers=cowin.get_availability_by_pincode(city_name,date,min_age_limit)print(available_centers)Notes:The API's of CoWin may at times return a 403 response. To mitigate this we are passing user agents in the
request. Still, if the issue persists please wait for a few minutes before trying again.License:MIT License