Created
May 5, 2021 09:02
-
-
Save py-ranoid/f57f918f080d9891fedd7de28b3ee733 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests, datetime, time | |
PINCODE, WAIT = '600096', 60 | |
def notify(available_sessions): | |
print("SESSIONS AVAILABLE :%r"%available_sessions) | |
while True: | |
resp = requests.get('https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByPin?pincode=600096&date=%s'%datetime.datetime.now().strftime("%d-%m-%Y")).json() | |
all_sessions = [(center['name'], session['date'], session['available_capacity']) for center in resp['centers'] for session in center['sessions'] if session['min_age_limit']==18] | |
available_sessions = [i for i in all_sessions if i[2]] | |
if available_sessions: notify(available_sessions) | |
time.sleep(WAIT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment