Skip to main content

Cowin Tracker

Python API wrapper for CoWin, 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.

Install

pip install taranvir-cowin-api-services

Usage

The wrapper currently covers four endpoints used by the CoWin portal specified below.

Initialize

from cowin_api import CoWinAPI

cowin = CoWinAPI()

Get all the available states

Returns the list of states in which vaccine drive is being conducted. This also returns the state_id which would be required in the subsequent requests.

from cowin_api import CoWinAPI

cowin = CoWinAPI()
states = cowin.get_states()
print(states)

Get all the available districts

Returns the list of districts in a particular states in which vaccine drive is being conducted. This also returns the district_id which would be required in the subsequent requests.

In this method, you would need to pass the state_id retrieved from the previous method.

from cowin_api import CoWinAPI

state_id = '<give state_id here>'
cowin = CoWinAPI()
districts = cowin.get_districts(state_id)
print(districts)

Get all the centers available using the district_id

Use this method to lookup for centers based on a district_id or a list of district_ids. This method is broader than searching by pin code as it covers the whole district.

In this method, you would need to pass the district_id retrieved 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.

from cowin_api import CoWinAPI

district_id = '<give the district_id here>'
date = '<Give the date here>'  # Optional. Takes today's date by default
min_age_limit = 18  # Optional. By default returns centers without filtering by min_age_limit

cowin = CoWinAPI()
available_centers = cowin.get_availability_by_district(district_id, date, min_age_limit)
print(available_centers)

Get all the available centers using a pin code

Use this method to lookup for centers based on a pin_code or a list of pin_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.

from cowin_api import CoWinAPI

pin_code = "<give pincode here>"
date = '<give date here>'  # Optional. Default value is today's date
min_age_limit = 18  # Optional. By default returns centers without filtering by min_age_limit

cowin = CoWinAPI()
available_centers = cowin.get_availability_by_pincode(pin_code, date, min_age_limit)
print(available_centers)

Contributions

Contributions are always welcome!

Feel free to modify according to your requirement.


License:

MIT License

Release files for cowin-app-services 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cowin-app-services 0.0.3
File Size Uploaded
cowin-app-services-0.0.3.tar.gz 4.5 kB Details

Release files / cowin-app-services-0.0.3.tar.gz

Download URL cowin-app-services-0.0.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5ea6b5dbbbe8588f66fbe8a227e4ff84cd47034cb545b9f914fb24355cb61443
BLAKE2b-256 checksum
How to use checksums
211a082721e1ef94442d2aef495f0e928e4ebd7f9e9d055911d6405c6fd79dc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.6.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page