added v6 rollback in case v7 does down for prepost
This commit is contained in:
parent
0d5faa7473
commit
d548c8b8a8
@ -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'
|
'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)
|
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']
|
prepost_data = prepost.json()['quoteResponse']['result']
|
||||||
time_now = datetime.now(pytz.timezone('America/New_York')).strftime("%H:%M EST")
|
time_now = datetime.now(pytz.timezone('America/New_York')).strftime("%H:%M EST")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user