api caller bugfix
This commit is contained in:
parent
bbd40b2160
commit
3220826cdc
@ -76,6 +76,8 @@ def updateStocksFinhubb():
|
||||
|
||||
def updateStocks():
|
||||
|
||||
|
||||
try:
|
||||
iexAPIkey = 'pk_d066d39789bd41caac209bca850a35db' #IEX
|
||||
|
||||
max_stocks = 200
|
||||
@ -86,7 +88,6 @@ def updateStocks():
|
||||
stock_info = all_stocks_settings['symbols']
|
||||
symbols = list(stock_info.keys())
|
||||
print(symbols)
|
||||
try:
|
||||
|
||||
valid_symbols = []
|
||||
current_prices = []
|
||||
@ -154,6 +155,11 @@ def updateStocks():
|
||||
|
||||
|
||||
def updateCrypto():
|
||||
|
||||
|
||||
#cypto_info['symbol, base'].keys() = ['current','24hr change']
|
||||
try:
|
||||
|
||||
coingecko_client = CoinGeckoAPI()
|
||||
|
||||
f = open('csv/crypto_settings.json', 'r')
|
||||
@ -187,9 +193,6 @@ def updateCrypto():
|
||||
|
||||
crypto_info = {}
|
||||
print(coins)
|
||||
|
||||
#cypto_info['symbol, base'].keys() = ['current','24hr change']
|
||||
try:
|
||||
response = coingecko_client.get_price(ids=','.join(coins), vs_currencies = unique_bases, include_24hr_change=True)
|
||||
|
||||
#print(response)
|
||||
@ -216,6 +219,9 @@ def updateCrypto():
|
||||
|
||||
def updateForex():
|
||||
|
||||
|
||||
|
||||
try:
|
||||
f = open('csv/forex_settings.json', 'r')
|
||||
all_forex_settings = json.load(f)
|
||||
f.close()
|
||||
@ -236,8 +242,6 @@ def updateForex():
|
||||
str_tod = datetime.strftime(datetime.now(), '%Y-%m-%d')
|
||||
str_yest = datetime.strftime(yesterday, '%Y-%m-%d')
|
||||
str_yestyest = datetime.strftime(yesteryesterday, '%Y-%m-%d')
|
||||
|
||||
try:
|
||||
for base in unique_bases:
|
||||
|
||||
url = 'https://api.frankfurter.app/{}..{}?from={}'.format(str_yestyest, str_tod, base)
|
||||
@ -433,13 +437,14 @@ def updateWeather():
|
||||
|
||||
def updateLeagueTables(api_key, league_ids):
|
||||
|
||||
|
||||
try:
|
||||
f = open('csv/league_tables.json', 'r')
|
||||
all_settings = json.load(f)
|
||||
f.close()
|
||||
|
||||
leagues = all_settings['leagues'].keys()
|
||||
leagues_info = {}
|
||||
try:
|
||||
for league in leagues:
|
||||
league_id = league_ids[league]
|
||||
url = 'https://www.thesportsdb.com/api/v1/json/{}/lookuptable.php?l={}&s=2020-2021'.format(api_key, league_id)
|
||||
@ -504,11 +509,12 @@ def updateLeagueEvents(api_key, league_ids, time):
|
||||
url = 'https://thesportsdb.com/api/v2/json/{}/livescore.php?l={}'
|
||||
|
||||
|
||||
|
||||
try:
|
||||
all_settings = json.load(f)
|
||||
f.close()
|
||||
leagues = all_settings['leagues'].keys()
|
||||
leagues_info = {}
|
||||
try:
|
||||
for league in leagues:
|
||||
league_id = league_ids[league]
|
||||
url = url.format(api_key, league_id)
|
||||
|
Loading…
Reference in New Issue
Block a user