Comments (1)
import requests
from pygame import mixer
from datetime import datetime, timedelta
import time
#Take essential inputs form user
age = int(input("Enter your Age : "))
pincodes = [input("Enter PIN Code: ")]
num_days = int(input("Enter number of days: "))
print_flag = 'Y'
print("Starting search for Covid vaccine slots!")
actual = datetime.today()
list_format = [actual + timedelta(days=i) for i in range(num_days)]
actual_dates = [i.strftime("%d-%m-%Y") for i in list_format]
while True:
counter = 0
for pincode in pincodes:
for given_date in actual_dates:
URL = "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByPin?pincode={}&date={}".format(
pincode, given_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'
}
result = requests.get(URL, headers=header)
if result.ok:
response_json = result.json()
if response_json["centers"]:
if (print_flag.lower() == 'y'):
for center in response_json["centers"]:
for session in center["sessions"]:
if (session["min_age_limit"] <= age
and session["available_capacity"] > 0):
print('Pincode: ' + pincode)
print(
"Available on: {}".format(given_date))
print("\t", center["name"])
print("\t", center["block_name"])
print("\t Price: ", center["fee_type"])
print("\t Availablity : ",
session["available_capacity"])
if (session["vaccine"] != ''):
print("\t Vaccine type: ",
session["vaccine"])
print("\n")
counter = counter + 1
else:
print("No Response!")
if counter:
print("No Vaccination slot available!")
else:
mixer.init()
mixer.music.load('sound/dingdong.wav')
mixer.music.play()
print("Search Completed!")
dt = datetime.now() + timedelta(minutes=3)
while datetime.now() < dt:
time.sleep(1)
from cowin-vaccine-notifier.
Related Issues (11)
- Counter says no vaccination available even if the availability is there HOT 5
- Can be modified with OOP approach and converted to CLI
- ModuleNotFoundError
- requested URL not working
- pygame.error: Couldn't open 'sound/dingdong.wav' HOT 1
- Changed and optimized sleep code. HOT 1
- Mismatch of results
- Hardcoded paramaters in the script HOT 1
- Unstructured format of the script
- Cowin API is not Realtime! HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cowin-vaccine-notifier.