bombardier-gif / covid-vaccine-booking

This very basic script can be used to automate COVID-19 vaccination slot booking on India's Co-WIN Platform.
375 stars 216 forks source link

Anyone who was able to book a slot with the current main branch? #344

Closed omkark96 closed 3 years ago

omkark96 commented 3 years ago

Was able to book slots with the 10th May 2021 main branch source code. Something has most likely broken as open slots are being missed by the script which defeats the whole aim of the project :(

Seems like added customization have created a lot of noise that might have let a bug or two slip in.

P.S.: I have hot-tested this twice with NO_PREFERENCE options for all the options to keep the chances of booking as wide as possible.

Ref: #321 #342 #345

omkark96 commented 3 years ago

https://github.com/bombardier-gif/covid-vaccine-booking/issues/301#issuecomment-846732460

To be honest. I dont like new features added at all. Our aim was basic vaccination for people who are desperate.

Second dose, cherry picking slots, centers, they make the code into spaghetti. People raise PRs and already spend so much time so I dont feel like rejecting their hard work.

Our work should be basically fixing the bugs in the core flow.

One suggestion to mitigate this: From now onwards, before starting work on any feature, create an issue and ask for opinions from the community. Only when there are no objections they can proceed on the work. Else they can work on their own branches.

Thoughts?

Strongly agree with this. @bombardier-gif

siddharthgoyal90 commented 3 years ago

Same, just have the slots open, but script was not able to pick them. Can we use the one we had just before that with that OTP validation issue fixed in that branch? @bombardier-gif

BlackRider97 commented 3 years ago

I just completed two booking with latest main branch code.
Can you share what error you are getting ?

siddharthgoyal90 commented 3 years ago

No errors. It just says no viable option available, inspite of the fact - on CoWIN platform, slots did opened up.

Nakul93 commented 3 years ago

@omkark96 @siddharthgoyal90 You can switch to a older commit and check if that works for you

shailesh commented 3 years ago

full log.txt

Error Log. I was able to book too but after so many tries which where already booked to the same center again and again

refers to. #340 #339

gitisuam commented 3 years ago

Yes even I was not able to book with current version. It says no viable options

siddharthgoyal90 commented 3 years ago

@omkark96 @siddharthgoyal90 You can switch to a older commit and check if that works for you

Already tried. It doesn't work for older branch, as for older branch it started giving OTP validation issue after entering registered mobile number from today morning/ late last night. It was working perfectly fine before that. See below: OTP Validation Issue

Is there a way we can fix this issue in branch just before this latest one to fix this OTP issue?

Best Regards,

omkark96 commented 3 years ago

@omkark96 @siddharthgoyal90 You can switch to a older commit and check if that works for you

Already tried. It doesn't work for older branch, as for older branch it started giving OTP validation issue after entering registered mobile number from today morning/ late last night. It was working perfectly fine before that. See below: OTP Validation Issue

Is there a way we can fix this issue in branch just before this latest one to fix this OTP issue?

Best Regards,

Change to these lines for fixing OTP validation issues: https://github.com/bombardier-gif/covid-vaccine-booking/blob/24a445c64649ac3b91e2a220ca92879ffe8bdad0/src/covid-vaccine-slot-booking.py#L33-L38

shivaslifzz commented 3 years ago

I am able to book the slots but only diffcult portion is entering the OTP manually everytime @bombardier-gif

Nakul93 commented 3 years ago

full log.txt

Error Log. I was able to book too but after so many tries which where already booked to the same center again and again

refers to. #340 #339

@BlackRider97 what are your thoughts on this. This is not good. I think we need to switch back to the older logic.

shailesh commented 3 years ago

Actually, if you see it tried the same center 26 times. I searched for this text "Center is fully booked..Trying another... " in the log shared above.

somewhere loop is breaking I guess.

shailesh commented 3 years ago
            for i in range(0, len(options)):
                option = options[i]
                all_slots_of_a_center = option.get("slots", [])
                if not all_slots_of_a_center:
                    continue

============> Trying Choice

take a kook at logs, it is interesting actually.

Nakul93 commented 3 years ago

Actually, if you see it tried the same center 26 times. I searched for this text "Center is fully booked..Trying another... " in the log shared above.

somewhere loop is breaking I guess.

Thats not good. I think you were lucky enough to get the slot even after so many retries. We definitely need to change the logic. Suggestion: Maybe pick a random center and iterate through all the slots, if everything is booked then that center should be marked as false and shouldn't be even displayed in the table and move on to the next random center

shailesh commented 3 years ago

I've got a doubt in checking slots_available, we just make it true false but where are we checking on dose_1 and dose_2 we have missed that in the code I guess where earlier we had this in place due to which I guess this kept trying for maybe 2nd dose or a 45+ centre but Cowin returned 409. with error message "This vaccination centre is completely booked for the selected date".

The second point might not be true but the first one slightly buggy I'm just guessing.

ghost commented 3 years ago

Today with the same script i did book 2 slot simultaneously at 17:00 without automatic captcha settings. But now getting OTP Len is :0 issue through iphone.

Screenshot 2021-05-25 at 21 47 44
Nakul93 commented 3 years ago

For the age group we already filtering that and according to the beneficiary and dose num is taken care here https://github.com/bombardier-gif/covid-vaccine-booking/blob/24a445c64649ac3b91e2a220ca92879ffe8bdad0/src/utils.py#L723-L732

What I don't get it is why is it iterating over the same slot which has been tried out already.

shailesh commented 3 years ago

Observations:

- Trying Choice # 0 Center # 612451, Slot #11:00 AM-01:00 PM ------> 3 times in log tried the same center same time and got 409: it should not be repeated if in the first place for this center and slot if it returned 409
- Trying Choice # 1 Center # 707148, Slot #11:00AM-01:00PM. ------> same with this 4 times | 409
- Trying Choice # 0 Center # 612451, Slot #01:00PM-03:00PM ------> 8 times | 409
- Trying Choice # 1 Center # 707148, Slot #09:00AM-11:00AM -------> 4 times | 409
- Trying Choice # 0 Center # 612451, Slot #01:00PM-03:00PM -------> 6 times | 409
- there are more............. it tried all combinations of center and slots and returned 409

Seeing above in the first place, should not be repeated if failed. update a dictionary with tried center id and slots for that session(must) because if the same center opened slots for another day this should not be the blocker.

Second need to check and verify if we are updating the list of center and availability if failed are going back to check the new center or looping in the first whatever we have in response?

BlackRider97 commented 3 years ago

@Nakul93 Logic is try for all centers and every slot of each center and if a center is fully booked then skip all other slots of that center.

shailesh commented 3 years ago

@Nakul93 Logic is try for all centers and every slot of each center and if a center is fully booked then skip all other slots of that center.

But this is happening repeatedly

Nakul93 commented 3 years ago

Exactly look at the logs by @shailesh

ghost commented 3 years ago

@shailesh @Nakul93 @bombardier-gif @BlackRider97 @BumpyKnuckls

this new script is missing the slots and even detecting the center's lately when all slots are gone and for areas where large amount of slots are available it is working normally

akashdmahali commented 3 years ago

I too was able to book slots this morning

ghost commented 3 years ago

Enter comma separated index numbers of beneficiaries to book for : 2 Selected beneficiaries: +-------+----------------+--------+-----------+-------+----------------+--------------+ | idx | bref_id | name | vaccine | age | status | dose1_date | +=======+================+========+===========+=======+================+==============+ | 1 | 66671805918150 | Hhsh | | 31 | Not Vaccinated | | +-------+----------------+--------+-----------+-------+----------------+--------------+

================================= Vaccine Info =================================

It seems you're trying to find a slot for your first dose. Do you have a vaccine preference? Enter 0 for No Preference, 1 for COVISHIELD, 2 for COVAXIN, or 3 for SPUTNIK V. Default 0 : 0

================================= Location Info =================================

Search by Pincode? Or by State/District Or Smart search State/District for selected Pincodes ? Enter 1 for Pincode or 2 for State/District or 3 for State/District filter by Pincodes (Optimized for rate-limit) (Default 2): 2 +-------+-----------------------------+ | idx | state | +=======+=============================+ | 1 | Andaman and Nicobar Islands | +-------+-----------------------------+ | 2 | Andhra Pradesh | +-------+-----------------------------+ | 3 | Arunachal Pradesh | +-------+-----------------------------+ | 4 | Assam | +-------+-----------------------------+ | 5 | Bihar | +-------+-----------------------------+ | 6 | Chandigarh | +-------+-----------------------------+ | 7 | Chhattisgarh | +-------+-----------------------------+ | 8 | Dadra and Nagar Haveli | +-------+-----------------------------+ | 9 | Daman and Diu | +-------+-----------------------------+ | 10 | Delhi | +-------+-----------------------------+ | 11 | Goa | +-------+-----------------------------+ | 12 | Gujarat | +-------+-----------------------------+ | 13 | Haryana | +-------+-----------------------------+ | 14 | Himachal Pradesh | +-------+-----------------------------+ | 15 | Jammu and Kashmir | +-------+-----------------------------+ | 16 | Jharkhand | +-------+-----------------------------+ | 17 | Karnataka | +-------+-----------------------------+ | 18 | Kerala | +-------+-----------------------------+ | 19 | Ladakh | +-------+-----------------------------+ | 20 | Lakshadweep | +-------+-----------------------------+ | 21 | Madhya Pradesh | +-------+-----------------------------+ | 22 | Maharashtra | +-------+-----------------------------+ | 23 | Manipur | +-------+-----------------------------+ | 24 | Meghalaya | +-------+-----------------------------+ | 25 | Mizoram | +-------+-----------------------------+ | 26 | Nagaland | +-------+-----------------------------+ | 27 | Odisha | +-------+-----------------------------+ | 28 | Puducherry | +-------+-----------------------------+ | 29 | Punjab | +-------+-----------------------------+ | 30 | Rajasthan | +-------+-----------------------------+ | 31 | Sikkim | +-------+-----------------------------+ | 32 | Tamil Nadu | +-------+-----------------------------+ | 33 | Telangana | +-------+-----------------------------+ | 34 | Tripura | +-------+-----------------------------+ | 35 | Uttar Pradesh | +-------+-----------------------------+ | 36 | Uttarakhand | +-------+-----------------------------+ | 37 | West Bengal | +-------+-----------------------------+

Enter State index: 5 +-------+----------------+ | idx | district | +=======+================+ | 1 | Araria | +-------+----------------+ | 2 | Arwal | +-------+----------------+ | 3 | Aurangabad | +-------+----------------+ | 4 | Banka | +-------+----------------+ | 5 | Begusarai | +-------+----------------+ | 6 | Bhagalpur | +-------+----------------+ | 7 | Bhojpur | +-------+----------------+ | 8 | Buxar | +-------+----------------+ | 9 | Darbhanga | +-------+----------------+ | 10 | East Champaran | +-------+----------------+ | 11 | Gaya | +-------+----------------+ | 12 | Gopalganj | +-------+----------------+ | 13 | Jamui | +-------+----------------+ | 14 | Jehanabad | +-------+----------------+ | 15 | Kaimur | +-------+----------------+ | 16 | Katihar | +-------+----------------+ | 17 | Khagaria | +-------+----------------+ | 18 | Kishanganj | +-------+----------------+ | 19 | Lakhisarai | +-------+----------------+ | 20 | Madhepura | +-------+----------------+ | 21 | Madhubani | +-------+----------------+ | 22 | Munger | +-------+----------------+ | 23 | Muzaffarpur | +-------+----------------+ | 24 | Nalanda | +-------+----------------+ | 25 | Nawada | +-------+----------------+ | 26 | Patna | +-------+----------------+ | 27 | Purnia | +-------+----------------+ | 28 | Rohtas | +-------+----------------+ | 29 | Saharsa | +-------+----------------+ | 30 | Samastipur | +-------+----------------+ | 31 | Saran | +-------+----------------+ | 32 | Sheikhpura | +-------+----------------+ | 33 | Sheohar | +-------+----------------+ | 34 | Sitamarhi | +-------+----------------+ | 35 | Siwan | +-------+----------------+ | 36 | Supaul | +-------+----------------+ | 37 | Vaishali | +-------+----------------+ | 38 | West Champaran | +-------+----------------+

Enter comma separated index numbers of districts to monitor : 4 Selected districts: +-------+---------------+-----------------+--------------+ | idx | district_id | district_name | alert_freq | +=======+===============+=================+==============+ | 1 | 83 | Banka | 1100 | +-------+---------------+-----------------+--------------+

================================= Additional Info =================================

Filter out centers with availability less than ? Minimum 1 : 1 How often do you want to refresh the calendar (in seconds)? Default 10. Minimum 5. (You might be blocked if the value is too low, in that case please try after a while with a lower frequency) : 7

Search for next seven day starting from when? Use 1 for today, 2 for tomorrow, or provide a date in the format dd-mm-yyyy. Default 2: 1

Do you have a fee type preference? Enter 0 for No Preference, 1 for Free Only, or 2 for Paid Only. Default 0 : 0

=========== CAUTION! =========== CAUTION! CAUTION! =============== CAUTION! =======

===== BE CAREFUL WITH THIS OPTION! AUTO-BOOKING WILL BOOK THE FIRST AVAILABLE CENTRE, DATE, AND A RANDOM SLOT! =====

================================= Captcha Automation =================================

Do you want to automate captcha autofill? (y/n) Default y:

================================= Save Info =================================

Would you like to save this as a JSON file for easy use next time?: (y/n Default y): n

================================= Confirm Info =================================

    beneficiary_dtls:

+-------+----------------+--------+-----------+-------+----------------+--------------+ | idx | bref_id | name | vaccine | age | status | dose1_date | +=======+================+========+===========+=======+================+==============+ | 1 | 66671805918150 | Hhsh | | 31 | Not Vaccinated | | +-------+----------------+--------+-----------+-------+----------------+--------------+ location_dtls: +-------+---------------+-----------------+--------------+ | idx | district_id | district_name | alert_freq | +=======+===============+=================+==============+ | 1 | 83 | Banka | 1100 | +-------+---------------+-----------------+--------------+ pin_code_location_dtls : [] search_option : 2 minimum_slots : 1 refresh_freq : 7 auto_book : yes-please start_date : 1 vaccine_type : None fee_type : ['Free', 'Paid'] captcha_automation : y

Proceed with above info (y/n Default y) :

Centers available in Banka from 26-05-2021 as of 2021-05-26 12:57:57: 13 +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | idx | name | district | pincode | vaccine | fee_type | available | date | slots | +=======+================================+============+===========+============+============+=============+============+==============================================================================+ | 1 | Girls HIGH School Amarpur18-44 | Banka | 813101 | COVISHIELD | Free | 63 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 2 | GNMSchool Administrative 18-44 | Banka | 813102 | COVISHIELD | Free | 243 | 26-05-2021 | ['09:00AM-11:00AM', '11:00AM-01:00PM', '01:00PM-03:00PM', '03:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 3 | PHC Banka Block 18-44 | Banka | 813102 | COVISHIELD | Free | 209 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 4 | Barahat SabhaagaarBarahat18-44 | Banka | 813103 | COVISHIELD | Free | 255 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 5 | OLD Hospital Baunsi 18-44 | Banka | 813104 | COVISHIELD | Free | 232 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 6 | Adarsh MiddleSchool KTOR 18-44 | Banka | 813106 | COVISHIELD | Free | 229 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 7 | P SchoolBaalBhartiRajoun 18-44 | Banka | 813107 | COVISHIELD | Free | 209 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 8 | PHC BELHAR OLD BULDING 18-44 | Banka | 813202 | COVISHIELD | Free | 257 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 9 | FullidumarBlockSabhaagaar18-44 | Banka | 813207 | COVISHIELD | Free | 239 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 10 | Primary School Kaurma 18-44 | Banka | 813211 | COVISHIELD | Free | 205 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 11 | High School Dhoraiya18-44 | Banka | 813224 | COVISHIELD | Free | 263 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ | 12 | OLD PHC Bulding Chandan18-44 | Banka | 814131 | COVISHIELD | Free | 274 | 26-05-2021 | ['10:00AM-11:00AM', '11:00AM-12:00PM', '12:00PM-01:00PM', '01:00PM-04:00PM'] | +-------+--------------------------------+------------+-----------+------------+------------+-------------+------------+------------------------------------------------------------------------------+ ============> Trying Choice # 0 Center # 563455, Slot #10:00AM-11:00AM Booking with info: {'beneficiaries': ['66671805918150'], 'dose': 1, 'center_id': 563455, 'session_id': '68ef9f68-b47a-427d-9673-3d7959564a38', 'slot': '10:00AM-11:00AM'} ================================= GETTING CAPTCHA ================================================== Captcha Response Code: 200 ================================= ATTEMPTING BOOKING ================================================== Booking Response Code: 200 Booking Response : {"appointment_confirmation_no":"bbd968a8-0028-488a-b4c2-0cbc7fd63ae6"} ############## BOOKED! ############################ BOOKED! ############## Hey, Hey, Hey! It's your lucky day!

Press any key thrice to exit program. Press any key to continue . . .

ghost commented 3 years ago

when tried here it is working like charm but in situations where slots are released at specific time like at 400053 around 1600 they release slots please check and let me know from last evening it is missing slots like hell @bombardier-gif @BumpyKnuckls

uzmamarturclim8invest commented 3 years ago

@gitmnj where u able to book for 400053 pin today using this script ?

ghost commented 3 years ago

I was not able to the script didn't showed the slots detected the centre when slots were gone

uzmamarturclim8invest commented 3 years ago

@gitmnj ya same happened with me. People have commented that the earlier version of script didnt have this problem. Is it true? Whats your thought is it due new commits? or CoWIN is able to detect the automated request and skipping them ?

ghost commented 3 years ago

I think it is because of the new commits in the code

ghost commented 3 years ago

Everything working great with this new script . I booked in Bombay with 2 Beneficiaries.

Thanks a Lot to everybody who helping the needy ones.

PFA screenshot .

Screenshot 2021-05-26 at 17 02 20
ghost commented 3 years ago

I think if u select more than 3 pin codes then it skipped for me also and u keep default frequency.

In the above mentioned booking i kept district as Mumbai and default frequency to be 7.

gitisuam commented 3 years ago

thanks @nolimits0007 .. Your trick to keep below 3 pincodes worked. I could book in Lilavati. @gitmnj - I am the same person who asked for 400053 to you. Please put less than 3 pin codes it works.

ghost commented 3 years ago

Ok will try with 3 pincodes

ghost commented 3 years ago

thanks @nolimits0007 .. Your trick to keep below 3 pincodes worked. I could book in Lilavati. @gitmnj - I am the same person who asked for 400053 to you. Please put less than 3 pin codes it works.

ur welcome @gitmnj. what i think above 3 pin code makes it difficult. but if u keep =<3 then it work . Whole district is not an issue at all. Frequency is also imp.

ghost commented 3 years ago

Yaa but I don't run the script once i get the notifications from telegram i start it

gitisuam commented 3 years ago

@gitmnj start atleast 2 mins before. bcz has telegram has its own seconds delay.

ghost commented 3 years ago

Yaa but the slots are like 800-900 still it never catch them manually I have booked

ghost commented 3 years ago

@gitmnj start at least 2 mins before. bcz has telegram has its own seconds delay.

Boss u have run script continuously. Use CoWinOtpRetreiver.apk on ur android so that ur token does not expires and that's it Hurray!!!. Try again and again till u succeed. Enjoy Happy Vaccination for u & help others . Don't wait for Telegram .

BlackRider97 commented 3 years ago

@bombardier-gif Can you also publish analytics daily reports collected from kvdb in automated manner. This will help in determining how many successful booking were made thru this. This will also help in highlighting any serious code issue in core path which is recently added to the repository. @shailesh thoughts ?

manojagarwal68 commented 3 years ago

Is this still an issue? One suggestion was limiting to 3 pincodes. But is that needed if you are choosing option 3 where you provide state/district and then list of pin codes? Because in that case it gets all the data and then filters the data..

ghost commented 3 years ago

Is this still an issue? One suggestion was limiting to 3 pin codes. But is that needed if you are choosing option 3 where you provide state/district and then list of pin codes? Because in that case it gets all the data and then filters the data..

I don't think that it will be an issue with option 3. I haven't tried but it will work fine.

imvishalpatel commented 3 years ago

was trying to book using search_option:3 but unable to do so. then started with seach_option:1 (by Pincode) with 3 Pincode and was able to book it. Thanks for the script.

shivaslifzz commented 3 years ago

After every 10 mins the centers are not refreshed for next 5mins but this not related to API limit because I ran the code with two different frequencies 30, 13 seconds both are blocked after 10 mins and released after new OTP any facing this issue????

image

image

ghost commented 3 years ago

After every 10 mins the centers are not refreshed for next 5mins but this not related to API limit because I ran the code with two different frequencies 30, 13 seconds both are blocked after 10 mins and released after new OTP any facing this issue????

image

image

Change frequency to 7 then try again. Don't exceed pin code more than 3.

omkark96 commented 3 years ago

Closing since pin codes <=3 and frequency between 6-8s works fine 👍🏻