In [ ]:
import os, sys, json
sys.path.insert(0, os.getenv('ENV_PYTHON_SRC_DIR', '/opt/work/src'))
from pycore import PyCore
print 'Initializing Python Core'
core = PyCore()
# the downloader is hardcoded for now to download to this shared volume + file location:
csv_file = '/opt/work/data/src/spy.csv'
# removing previous csv file if it exists
if os.path.exists(csv_file):
core.lg('Removing Previous(' + str(csv_file) + ')')
os.system('rm -f ' + str(csv_file) + ')')
# end of removing previous
downloader_name = 'download-spy-csv.py'
path_to_downloader = os.getenv('ENV_BINS', '/opt/work/bins/') + '/' + downloader_name
core.lg('Downloading latest SPY Pricing with Download(' + str(path_to_downloader) + ')', 2)
os.system(path_to_downloader)
core.lg('')
core.lg('Checking CSV is Ready')
if os.path.exists(csv_file):
core.lg(' SUCCESS - File Exists: ' + str(csv_file), 5)
else:
core.lg(' ERROR: Failed to find CSV(' + str(csv_file) + ')', 0)
# end of if/else download was successful