forked from wmarshall484/nps_hack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_future_camps.py
More file actions
34 lines (31 loc) · 1.04 KB
/
check_future_camps.py
File metadata and controls
34 lines (31 loc) · 1.04 KB
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
from consts import GLACIER_SITES, YOSEMITE_SITES
from camp_checker import notify_when_available
from datetime import datetime
def main():
year = str(datetime.now().year)
month = f'{datetime.now().month:02}' # 0-padded month integer
day = '01' # NOTE: month query only accepts the first of the month
if int(month) < 11:
additional_months = 2
END_MONTH = datetime.now().month + additional_months
elif int(month) == 11:
additional_months = 1
END_MONTH = datetime.now().month + additional_months
else:
END_MONTH = 12
while int(month) <= END_MONTH:
print(f'{year}-{month}-{day}')
for key in YOSEMITE_SITES:
_args = {
"camp_key": key,
"year": year,
"month": month,
"day": day,
};
print(f'Campsite {key}')
notify_when_available(**_args)
month = int(month) + 1
month = f'{month:02}'
if __name__ == "__main__":
# execute only if run as a script
main()