./covid-vaccine-slot-booking.py [--mobile <mobile_no>] [--token <token>] [--kvdb-bucket <kvdb_bucket_key] [--config <path_to_config] [--no-tty]
This very basic CLI based script can be used to automate covid vaccination slot booking on Co-WIN Platform.
Note: All parameters are optional.
Parameter | Description |
---|---|
–mobile | Registered mobile on CoWIN |
–token | Token of the user |
–kvdb-bucket | kvdb.io bucket key |
–config | Path to store the configuration file |
–no-tty | Do not ask any terminal inputs. Proceed with smart choices |
Environment Variable | Description |
---|---|
BEEP | Setting no skips beeps |
KVDB_BUCKET | kvdb.io bucket key |
This very basic CLI based script can be used to automate covid vaccination slot booking on Co-WIN Platform.
python src\covid-vaccine-slot-booking.py
Select Beneficiaries. Read the important notes. You can select multiple beneficiaries by providing comma-separated index values such as 1,2
:
Enter the registered mobile number: ██████████
Requesting OTP with mobile number ██████████..
Enter OTP: 999999
Validating OTP..
Token Generated: █████████████████████████████████████████████████████████████
Fetching registered beneficiaries..
+-------+----------------------------+---------------------------+------------+
| idx | beneficiary_reference_id | name | vaccine |
+=======+============================+===========================+============+
| 1 | ██████████████ | █████████████████████████ | COVISHIELD |
+-------+----------------------------+---------------------------+------------+
| 2 | ██████████████ | █████████████████ | |
+-------+----------------------------+---------------------------+------------+
################# IMPORTANT NOTES #################
# 1. While selecting beneficiaries, make sure that selected beneficiaries are all taking the same dose: either first OR second.
# Please do no try to club together booking for first dose for one beneficiary and second dose for another beneficiary.
#
# 2. While selecting beneficiaries, also make sure that beneficiaries selected for second dose are all taking the same vaccine: COVISHIELD OR COVAXIN.
# Please do no try to club together booking for beneficiary taking COVISHIELD with beneficiary taking COVAXIN.
###################################################
Enter comma separated index numbers of beneficiaries to book for : 2
Ensure correct beneficiaries are getting selected:
Selected beneficiaries:
+-------+----------------------------+-----------+
| idx | beneficiary_reference_id | vaccine |
+=======+============================+===========+
| 1 | ██████████████ | |
+-------+----------------------------+-----------+
+-------+-----------------------------+
| idx | state |
+=======+=============================+
| 1 | Andaman and Nicobar Islands |
+-------+-----------------------------+
| 2 | Andhra Pradesh |
+-------+-----------------------------+
+-------+-----------------------------+
+-------+-----------------------------+
| 35 | Uttar Pradesh |
+-------+-----------------------------+
| 36 | Uttarakhand |
+-------+-----------------------------+
| 37 | West Bengal |
+-------+-----------------------------+
Enter State index: 18
+-------+--------------------+
| idx | district |
+=======+====================+
| 1 | Alappuzha |
+-------+--------------------+
| 2 | Ernakulam |
+-------+--------------------+
| 3 | Idukki |
+-------+--------------------+
+-------+--------------------+
+-------+--------------------+
| 13 | Thrissur |
+-------+--------------------+
| 14 | Wayanad |
+-------+--------------------+
Enter comma separated index numbers of districts to monitor : 2,13
Selected districts:
+-------+---------------+-----------------+-----------------------+
| idx | district_id | district_name | district_alert_freq |
+=======+===============+=================+=======================+
| 1 | 307 | Ernakulam | 660 |
+-------+---------------+-----------------+-----------------------+
| 2 | 303 | Thrissur | 3080 |
+-------+---------------+-----------------+-----------------------+
Filter out centers with availability less than: 5
Note
: It will ask you monitor frequency ProTip
: Do not select less than 5 seconds it will bombard cowin server and will get your request blocked, create issues in OTP generation for your number. #85
===================================================================================
Centers available in Ernakulam from 01-05-2021 as of 2021-04-30 15:13:44: 0
Centers available in Thrissur from 01-05-2021 as of 2021-04-30 15:13:44: 0
No viable options. Waiting for next update in 15s.
===================================================================================
Centers available in Ernakulam from 01-05-2021 as of 2021-04-30 15:13:59: 0
Centers available in Thrissur from 01-05-2021 as of 2021-04-30 15:13:59: 0
No viable options. Waiting for next update in 15s.
y
or n
. If you’d like to continue, provide y
and proceed to allow using same mobile number
Token is INVALID.
Try for a new Token? (y/n): y
Try for OTP with mobile number ███████████? (y/n) : y
Enter OTP: 888888
===================================================================================
Centers available in Ernakulam from 01-05-2021 as of 2021-04-30 15:34:19: 1
Centers available in Thrissur from 01-05-2021 as of 2021-04-30 15:34:19: 0
+-------+----------------+------------+-------------+------------+------------------------------------------------------------------------------+
| idx | name | district | available | date | slots |
+=======+================+============+=============+============+==============================================================================+
| 1 | Ayyampilly PHC | Ernakulam | 30 | 01-05-2021 | ['09:00AM-10:00AM', '10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-02:00PM'] |
+-------+----------------+------------+-------------+------------+------------------------------------------------------------------------------+
----------> Wait 10 seconds for updated options OR
----------> Enter a choice e.g: 1.4 for (1st center 4th slot): 1.3
centerIndex.slotIndex
eg: The input1.4
will select the vaccination center in second row and its fourth slot.mobile_appointmentno
.Can't setFont(Times-Roman) missing the T1 files?
Originally <class 'TypeError'>: makeT1Font() argument 2 must be str, not None
Solution 1: Then run the python script directly in the src folder after installing the required modules from requirements.txt. That solved it for me
Solution 2: If you are running ubantu(tested) or Windows, this problem is due to some font files from package (reportlab) which are included in arch linux but not on Ubuntu. Follow these steps to install reportlab correctly. It can be done after you have installed all the requirements rom txt file.
git clone https://github.com/Distrotech/reportlab.git
cd reportlab
python3 setup.py install
This will download all the font files.
Solution 3: Try to perform the test first in test folder for captcha first to see if this error still there.
Solution 4: (Recommended) Try to use this Linux executable “ ./covid-vaccine-slot-booking-linux “ file directly from terminal it does not require anything to install just like windows exe. Windows exe is under going testing
Regarding beep package - Device not found or beep not found
Solution : Follow these steps for Ubuntu
sudo apt-get install beep
#Install this oncesudo modeprobe pcspkr
#This will solve Device not found errorbeep
in terminal, this will produce a beep sound from your speakers.SMS is not read automatically
Solution: Make sure the settings shown below are the same on your phone:
Using IFTTT: This number must match the number you enter while running the script. |
CowinOTPRetriever App: Make sure the switch is flipped on. |
pytest
pytest
from requirements.txt
if not already installedsrc/conftest.py
is an empty config file needed for pytest to runpython3 -m pytest
from command line from the repo root to execute all tests in src/tests