Interact with CoWin APIs
Project description
Cowin API
Python package to interact with COWIN Public API
Features
- Supports both Synchronous and Asynchronous modes.
- 95% test coverage with mocking API responses.
- Get list of states
- Get list of districts for a state
- Generate and Verify OTP
- Download Certificates
Example:
For API response payload samples visit the API portal.
# blocking synchronous client
from cowin import Cowin
client = Cowin()
states = client.get_states()
districts = client.get_districts(state_id=4)
# below function accepts optional datetime.date object
# by default current date is used
vaccine_sessions = client.get_sessions_by_pincode(pincode='605001')
# get OTP to mobile number
response = client.get_otp(mobile='9876543210')
txn_id = response['txnId']
# verify OTP and receive token
response = client.confirm_otp(txn_id=txn_id, otp='123456')
token = response['token']
# non-blocking async client
from cowin import AsyncCowin
async_client = AsyncCowin()
states = await async_client.get_stateS()
districts = await async_client.get_districts(state_id=4)
vaccine_sessions = await async_client.get_sessions_by_pincode(pincode='605001')
# get OTP to mobile number
response = await async_client.get_otp(mobile='9876543210')
txn_id = response['txnId']
# verify OTP and receive token
response = await async_client.confirm_otp(txn_id=txn_id, otp='123456')
token = response['token']
Contributions
Issues and pull requests are welcome. Feel free to improve the package.
License:
LGPL v3.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cowin-async-1.0.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cowin_async-1.0-py3-none-any.whl
(14.5 kB
view details)
File details
Details for the file cowin-async-1.0.tar.gz.
File metadata
- Download URL: cowin-async-1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc228c59b823ed540621610c11563eb1d5d5e2d9821c6deeb8533818ee0f838f
|
|
| MD5 |
662fd007fd189341844cf892be3de408
|
|
| BLAKE2b-256 |
2f4a9c9149c37be30be4149e0b80b64c915c2e4d43db178603ce746dc033a8c4
|
File details
Details for the file cowin_async-1.0-py3-none-any.whl.
File metadata
- Download URL: cowin_async-1.0-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15f017679640e3c4c67b2c9a5bfd3ace45dd9f3912bad7a0cbf63e54d4cfad56
|
|
| MD5 |
23312592d01945ec0e78d1526c9e2908
|
|
| BLAKE2b-256 |
1cba2bf2bc32a6ab5b2eedf1021343f8c1fbabd8bc26cdc674cd41740d952e33
|