-
Notifications
You must be signed in to change notification settings - Fork 0
/
ageFiltered.py
83 lines (75 loc) · 4.06 KB
/
ageFiltered.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import time
from datetime import timedelta
import filterCenters
import getListofCenters
import outputPrettifier
import getFormattedDate
def getAgeGroup(age):
if age>=45:
return 45
else:
return 18
def getPaid(select_age_flag,num_weeks,today,district_id,age):
if select_age_flag == 1:
print(
f"\n\n\n----------------------Paid centers for minimum Age {age}------------------------------\n")
for i in range(num_weeks): # searching for 3 weeks
getDateFormatted = getFormattedDate.getDate(today)
response = getListofCenters.getListOfCenters(
district_id, getDateFormatted)
if response.status_code == 200:
availableDates = filterCenters.getAgeBasedCentersPaid(response, age)
if availableDates=={}:
print(f"\tNone showing from {getDateFormatted} till {getFormattedDate.getDate(today+timedelta(weeks=1))}\n")
else:
outputPrettifier.prettyprint(availableDates)
else:
print(f"\tError accessing data from Cowin for dates from date {getDateFormatted} till {getFormattedDate.getDate(today+timedelta(weeks=1))}, try again\n")
today = today+timedelta(weeks=1)
else:
print(f"----------------------Paid-> All ages------------------------------------")
for i in range(num_weeks): # searching for 3 weeks
getDateFormatted = getFormattedDate.getDate(today)
response = getListofCenters.getListOfCenters(
district_id, getDateFormatted)
if response.status_code == 200:
availableDates = filterCenters.getAllCentersPaid(response, age)
if availableDates=={}:
print(f"\tNone showing from {getDateFormatted} till {getFormattedDate.getDate(today+timedelta(weeks=1))}\n")
else:
outputPrettifier.prettyprint(availableDates)
else:
print(f"\tError accessing data from Cowin for date{getDateFormatted}, try again\n")
today = today+timedelta(weeks=1)
def getUnpaid(select_age_flag,num_weeks,today,district_id,age):
if select_age_flag == 1:
print(
f"\n\n\n----------------------Unpaid centers for minimum Age {age}------------------------------\n")
for i in range(num_weeks): # searching for 3 weeks
getDateFormatted = getFormattedDate.getDate(today)
response = getListofCenters.getListOfCenters(
district_id, getDateFormatted)
if response.status_code == 200:
availableDates = filterCenters.getAgeBasedCentersUnpaid(response, age)
if availableDates=={}:
print(f"\tNone showing from {getDateFormatted} till {getFormattedDate.getDate(today+timedelta(weeks=1))}\n")
else:
outputPrettifier.prettyprint(availableDates)
else:
print(f"\tError accessing data from Cowin for dates from date {getDateFormatted} till {getFormattedDate.getDate(today+timedelta(weeks=1))}, try again\n")
today = today+timedelta(weeks=1)
else:
print(f"----------------------Unpaid-> All ages------------------------------------")
for i in range(num_weeks): # searching for 3 weeks
getDateFormatted = getFormattedDate.getDate(today)
response = getListofCenters.getListOfCenters(
district_id, getDateFormatted)
if response.status_code == 200:
availableDates = filterCenters.getAllCentersUnpaid(response, age)
if availableDates=={}:
print(f"\tNone showing from {getDateFormatted} till {getFormattedDate.getDate(today+timedelta(weeks=1))}\n")
else:
outputPrettifier.prettyprint(availableDates)
else:
print(f"\tError accessing data from Cowin for date{getDateFormatted}, try again\n")
today = today+timedelta(weeks=1)