diff --git a/crypto_portfolio.py b/crypto_portfolio.py index 6929b08..30e5c76 100644 --- a/crypto_portfolio.py +++ b/crypto_portfolio.py @@ -9,8 +9,12 @@ import mplfinance as mpf # a chave da API 'CHAVE_API_DEMO' if not os.path.exists('modulos/constantes.py'): chave_api = input('Introduza a chave da API Demo de CoinGecko: ') - with open('modulos/constantes.py', 'w') as f: - f.write(f'CHAVE_API_DEMO = \'{chave_api}\'\n') + if (not aux.validarChaveAPI(chave_api)): + print(f'erro na validação da chave API {chave_api}') + quit() + else: + with open('modulos/constantes.py', 'w') as f: + f.write(f'CHAVE_API_DEMO = \'{chave_api}\'\n') import modulos.coingecko_api as cgapi