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