diff --git a/slack-bot/traffic-scraper/prd/__pycache__/pullTrafficInfo.cpython-37.pyc b/slack-bot/traffic-scraper/prd/__pycache__/pullTrafficInfo.cpython-37.pyc index 826c4f4..747d955 100644 Binary files a/slack-bot/traffic-scraper/prd/__pycache__/pullTrafficInfo.cpython-37.pyc and b/slack-bot/traffic-scraper/prd/__pycache__/pullTrafficInfo.cpython-37.pyc differ diff --git a/slack-bot/traffic-scraper/prd/__pycache__/receiveFromSQS.cpython-37.pyc b/slack-bot/traffic-scraper/prd/__pycache__/receiveFromSQS.cpython-37.pyc index 8803746..29d4b2e 100644 Binary files a/slack-bot/traffic-scraper/prd/__pycache__/receiveFromSQS.cpython-37.pyc and b/slack-bot/traffic-scraper/prd/__pycache__/receiveFromSQS.cpython-37.pyc differ diff --git a/slack-bot/traffic-scraper/prd/__pycache__/sendToSQS.cpython-37.pyc b/slack-bot/traffic-scraper/prd/__pycache__/sendToSQS.cpython-37.pyc index 9f81004..a5e001e 100644 Binary files a/slack-bot/traffic-scraper/prd/__pycache__/sendToSQS.cpython-37.pyc and b/slack-bot/traffic-scraper/prd/__pycache__/sendToSQS.cpython-37.pyc differ diff --git a/slack-bot/traffic-scraper/prd/loadResults.py b/slack-bot/traffic-scraper/prd/loadResults.py index 5798372..b735143 100644 --- a/slack-bot/traffic-scraper/prd/loadResults.py +++ b/slack-bot/traffic-scraper/prd/loadResults.py @@ -1,8 +1,17 @@ import json +import glob +import os -with open('/Users/dtomlinson/OneDrive - William Hill Organisation Limited' - '/Mac/git_repos/python-VM/slack-bot/traffic-scraper/' - 'prd/12-10-2019_02:53:32.json', 'r') as jsonFile: +listOfFiles = glob.glob(f'{os.getcwd()}/*.json') +latestFile = max(listOfFiles, key=os.path.getctime) + +with open(latestFile, 'r') as jsonFile: data = json.load(jsonFile) for item in data: print(item) + +listOfFiles.remove(latestFile) + +if len(listOfFiles) > 2: + for files in listOfFiles: + os.remove(files)