Changed join to price table to a LEFT JOIN so that I can also keep track of the Alamo restaurant operating hours with the same tables

This commit is contained in:
wes
2024-05-20 13:35:46 -04:00
parent 0ce13cf8a4
commit 1678a2f5a6
4 changed files with 88 additions and 1 deletions
+10 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
from datetime import datetime, date
import json, requests, psycopg2, logging
import json, requests, psycopg2, logging, sys
from psycopg2 import sql
ATTRACTIONS_IO_ENDPOINT = "https://live-data.attractions.io/72f0ea9e-d196-508a-bee8-cce62c3228c7.json"
@@ -152,6 +152,15 @@ logging.info('Fetching most recent park hours entry from DB...')
park_hours_pull = generic_query(park_hours_query)[0]
logging.debug('%s - %s', park_hours_pull[2], park_hours_pull[3])
try:
closed = park_hours_pull[4]
except:
closed = False
if park_hours_pull[4]:
logging.info('Park closed today. Exiting...')
sys.exit()
if park_hours_pull[2].date() == date.today():
logging.info('Park hours for today already in DB')
park_opens = park_hours_pull[2]