diff --git a/database_caller.py b/database_caller.py index 8fe46b4..80710bf 100755 --- a/database_caller.py +++ b/database_caller.py @@ -160,6 +160,10 @@ def updateStocksPrePost(api_key, logf): 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36' } prepost = requests.get(prepost_url, headers=headers) + + if 'Unauthorized' in str(prepost.json()): + prepost = requests.get(prepost_url.replace('v7','v6'), headers=headers) + prepost_data = prepost.json()['quoteResponse']['result'] time_now = datetime.now(pytz.timezone('America/New_York')).strftime("%H:%M EST")