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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user