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

Major issue: After every 10 mins the centers are not refreshed #382

Closed shivaslifzz closed 3 years ago

shivaslifzz commented 3 years ago

@bombardier-gif After every 10 mins the centers are not refreshed for next 5 mins or untill the new otp comes back

currently my refresh_frequency is 30 seconds

image

6mxo89sqh commented 3 years ago

@shivaslifzz

CoWIN's api rate limit is 100 per five minute for an IP. You need to ensure you don't pass more than that. Each district and each pin contribute to an API call.

Example: Lets say i am searching for 2 pincode. At refresh rate of 5sec, my total requests in 5 min would be 120. [ I will get blocked ] At refresh rate of 6sec, my total requests in 5 min would be 100. [ I may get blocked when there are OTP calls] At refresh rate of 7sec, my total requests in 5 min would be 85. [ GOOD ]

Formula: 5 x 60 x refresh rate / no of api calls

Calculate your API calls and you should be good. If you are using Pincode based search, use option 3 as it will save your calls.

Also, if you are cowin/umang/arogya setu is open in on same network (by you or your family on same or different device) that impacts this.

I will add a fix to show the error message.

shivaslifzz commented 3 years ago

@6mxo89sqh @bombardier-gif I guess issue is not with the no of API calls why because I ran the same code with two different refresh frequencies 30,13 seconds both of them are blocked after 10mins , I guess they might added the duration as well apart from the API calls please check

6mxo89sqh commented 3 years ago

@shivaslifzz I will check. In mean time, can u check option 3 ( search by district n filter by pincode) if that is increasing the time from 10 minutes to something else?

6mxo89sqh commented 3 years ago

@shivaslifzz Yup, you are correct. they are raising 429 after 10 minutes of usage. I have added code to forcefully expire the token in 10 minutes. Can you plz check?

shivaslifzz commented 3 years ago

@6mxo89sqh I am checking it now

shivaslifzz commented 3 years ago

@6mxo89sqh Bro now it's working fine

bombardier-gif commented 3 years ago

Thanks @shivaslifzz for confirming that it works for you now.