-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvaccinefinder.py
33 lines (28 loc) · 988 Bytes
/
vaccinefinder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import requests
import time
from playsound import playsound
dist = 188
date = '05-07-2024'
URL = 'https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/findByDistrict?district_id={}&date={}'.format(
dist, date)
header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36'}
def findAvailability():
counter = 0
result = requests.get(URL, headers=header)
response_json = result.json()
data = response_json["sessions"]
for each in data:
if((each["available_capacity_dose2"] > 0) & (each["min_age_limit"] == 18)):
counter += 1
print(each["name"])
print(each["pincode"])
print(each["vaccine"])
print(each["available_capacity"])
return True
if(counter == 0):
print("No Available Slots")
return False
while(findAvailability() != True):
time.sleep(5)
findAvailability()