diff options
author | James Maslek <jmaslek11@gmail.com> | 2023-06-07 04:36:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 08:36:39 +0000 |
commit | 316e83dc003f613c51a6ba2c8fedfc3e480a0236 (patch) | |
tree | 72608e4e1eaf286d4886581902ebaa09dd1f4130 | |
parent | f42b9e87ba22a88ffdf1a2f16af00a376730b93f (diff) |
Remove all key logger.info (#5112)
Co-authored-by: Henrique Joaquim <h.joaquim@campus.fct.unl.pt>
-rw-r--r-- | openbb_terminal/keys_model.py | 84 |
1 files changed, 5 insertions, 79 deletions
diff --git a/openbb_terminal/keys_model.py b/openbb_terminal/keys_model.py index 65aecf752d2..7b177bf62ee 100644 --- a/openbb_terminal/keys_model.py +++ b/openbb_terminal/keys_model.py @@ -314,7 +314,6 @@ def check_av_key(show_output: bool = False) -> str: if ( current_user.credentials.API_KEY_ALPHAVANTAGE == "REPLACE_ME" ): # pragma: allowlist secret - logger.info("Alpha Vantage key not defined") status = KeyStatus.NOT_DEFINED else: df = TimeSeries( @@ -324,7 +323,6 @@ def check_av_key(show_output: bool = False) -> str: logger.warning("Alpha Vantage key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED else: - logger.info("Alpha Vantage key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED if show_output: @@ -384,7 +382,6 @@ def check_fmp_key(show_output: bool = False) -> str: current_user.credentials.API_KEY_FINANCIALMODELINGPREP == "REPLACE_ME" # pragma: allowlist secret ): # pragma: allowlist secret - logger.info("Financial Modeling Prep key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -395,7 +392,6 @@ def check_fmp_key(show_output: bool = False) -> str: logger.warning("Financial Modeling Prep key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("Financial Modeling Prep key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Financial Modeling Prep key defined, test inconclusive") @@ -458,13 +454,11 @@ def check_quandl_key(show_output: bool = False) -> str: if ( current_user.credentials.API_KEY_QUANDL == "REPLACE_ME" ): # pragma: allowlist secret - logger.info("Quandl key not defined") status = KeyStatus.NOT_DEFINED else: try: quandl.save_key(current_user.credentials.API_KEY_QUANDL) quandl.get("EIA/PET_RWTC_D") - logger.info("Quandl key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except Exception as _: # noqa: F841 logger.warning("Quandl key defined, test failed") @@ -525,7 +519,6 @@ def check_polygon_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_POLYGON_KEY == "REPLACE_ME": - logger.info("Polygon key not defined") status = KeyStatus.NOT_DEFINED else: check_date = date(date.today().year, date.today().month, 1).isoformat() @@ -537,7 +530,6 @@ def check_polygon_key(show_output: bool = False) -> str: logger.warning("Polygon key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("Polygon key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Polygon key defined, test inconclusive") @@ -598,7 +590,6 @@ def check_fred_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_FRED_KEY == "REPLACE_ME": - logger.info("FRED key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -608,7 +599,6 @@ def check_fred_key(show_output: bool = False) -> str: logger.warning("FRED key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("FRED key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("FRED key defined, test inconclusive") @@ -669,7 +659,6 @@ def check_news_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_NEWS_TOKEN == "REPLACE_ME": # nosec - logger.info("News API key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -679,7 +668,6 @@ def check_news_key(show_output: bool = False) -> str: logger.warning("News API key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("News API key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("News API key defined, test inconclusive") @@ -740,7 +728,6 @@ def check_biztoc_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_BIZTOC_TOKEN == "REPLACE_ME": # nosec - logger.info("BizToc API key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -754,7 +741,6 @@ def check_biztoc_key(show_output: bool = False) -> str: logger.warning("BizToc API key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("BizToc API key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("BizToc API key defined, test inconclusive") @@ -815,7 +801,6 @@ def check_tradier_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_TRADIER_TOKEN == "REPLACE_ME": # nosec - logger.info("Tradier key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -830,7 +815,6 @@ def check_tradier_key(show_output: bool = False) -> str: logger.warning("Tradier key not defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("Tradier key not defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Tradier key not defined, test inconclusive") @@ -890,17 +874,14 @@ def check_cmc_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_CMC_KEY == "REPLACE_ME": - logger.info("Coinmarketcap key not defined") status = KeyStatus.NOT_DEFINED else: cmc = CoinMarketCapAPI(current_user.credentials.API_CMC_KEY) try: cmc.cryptocurrency_map() - logger.info("Coinmarketcap key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except Exception: - logger.info("Coinmarketcap key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED if show_output: @@ -958,7 +939,6 @@ def check_finnhub_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_FINNHUB_KEY == "REPLACE_ME": - logger.info("Finnhub key not defined") status = KeyStatus.NOT_DEFINED else: r = r = request( @@ -968,7 +948,6 @@ def check_finnhub_key(show_output: bool = False) -> str: logger.warning("Finnhub key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("Finnhub key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Finnhub key defined, test inconclusive") @@ -1063,7 +1042,6 @@ def check_reddit_key(show_output: bool = False) -> str: current_user.credentials.API_REDDIT_USER_AGENT, ] if "REPLACE_ME" in reddit_keys: - logger.info("Reddit key not defined") status = KeyStatus.NOT_DEFINED else: try: @@ -1089,7 +1067,6 @@ def check_reddit_key(show_output: bool = False) -> str: ) praw_api.user.me() - logger.info("Reddit key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except (Exception, ResponseException): logger.warning("Reddit key defined, test failed") @@ -1152,7 +1129,6 @@ def check_bitquery_key(show_output: bool = False) -> str: bitquery = current_user.credentials.API_BITQUERY_KEY if "REPLACE_ME" in bitquery: - logger.info("Bitquery key not defined") status = KeyStatus.NOT_DEFINED else: headers = {"x-api-key": current_user.credentials.API_BITQUERY_KEY} @@ -1171,7 +1147,6 @@ def check_bitquery_key(show_output: bool = False) -> str: headers=headers, ) if r.status_code == 200: - logger.info("Bitquery key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Bitquery key defined, test failed") @@ -1247,7 +1222,6 @@ def check_twitter_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_TWITTER_BEARER_TOKEN == "REPLACE_ME": - logger.info("Twitter key not defined") status = KeyStatus.NOT_DEFINED else: params = { @@ -1264,7 +1238,6 @@ def check_twitter_key(show_output: bool = False) -> str: }, ) if r.status_code == 200: - logger.info("Twitter key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED elif r.status_code in [401, 403]: logger.warning("Twitter key defined, test failed") @@ -1342,12 +1315,11 @@ def check_rh_key(show_output: bool = False) -> str: current_user.credentials.RH_USERNAME, current_user.credentials.RH_PASSWORD, ] - if "REPLACE_ME" in rh_keys: - logger.info("Robinhood key not defined") - status = KeyStatus.NOT_DEFINED - else: - logger.info("Robinhood key defined, not tested") - status = KeyStatus.DEFINED_NOT_TESTED + status = ( + KeyStatus.NOT_DEFINED + if "REPLACE_ME" in rh_keys + else KeyStatus.DEFINED_NOT_TESTED + ) if show_output: console.print(status.colorize()) @@ -1425,7 +1397,6 @@ def check_degiro_key(show_output: bool = False) -> str: current_user.credentials.DG_TOTP_SECRET, ] if "REPLACE_ME" in dg_keys: - logger.info("Degiro key not defined") status = KeyStatus.NOT_DEFINED else: dg = DegiroModel() @@ -1435,16 +1406,13 @@ def check_degiro_key(show_output: bool = False) -> str: check_creds = dg.check_credentials() # pylint: disable=no-member if "2FA is enabled" in f.getvalue() or check_creds: - logger.info("Degiro key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: raise Exception - logger.info("Degiro key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except Exception: - logger.info("Degiro key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED del dg # ensure the object is destroyed explicitly @@ -1525,7 +1493,6 @@ def check_oanda_key(show_output: bool = False) -> str: current_user.credentials.OANDA_ACCOUNT, ] if "REPLACE_ME" in oanda_keys: - logger.info("Oanda key not defined") status = KeyStatus.NOT_DEFINED else: client = oanda_API(access_token=current_user.credentials.OANDA_TOKEN) @@ -1536,11 +1503,9 @@ def check_oanda_key(show_output: bool = False) -> str: accountID=account, params=parameters ) client.request(request_) - logger.info("Oanda key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except Exception: - logger.info("Oanda key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED if show_output: @@ -1613,7 +1578,6 @@ def check_binance_key(show_output: bool = False) -> str: current_user.credentials.API_BINANCE_KEY, current_user.credentials.API_BINANCE_SECRET, ]: - logger.info("Binance key not defined") status = KeyStatus.NOT_DEFINED else: @@ -1623,7 +1587,6 @@ def check_binance_key(show_output: bool = False) -> str: current_user.credentials.API_BINANCE_SECRET, ) client.get_account_api_permissions() - logger.info("Binance key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except Exception: logger.warning("Binance key defined, test failed") @@ -1704,7 +1667,6 @@ def check_coinbase_key(show_output: bool = False) -> str: current_user.credentials.API_COINBASE_SECRET, current_user.credentials.API_COINBASE_PASS_PHRASE, ]: - logger.info("Coinbase key not defined") status = KeyStatus.NOT_DEFINED else: auth = CoinbaseProAuth( @@ -1720,7 +1682,6 @@ def check_coinbase_key(show_output: bool = False) -> str: logger.warning("Coinbase key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED else: - logger.info("Coinbase key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED if show_output: @@ -1778,7 +1739,6 @@ def check_walert_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_WHALE_ALERT_KEY == "REPLACE_ME": - logger.info("Walert key not defined") status = KeyStatus.NOT_DEFINED else: url = ( @@ -1791,10 +1751,8 @@ def check_walert_key(show_output: bool = False) -> str: logger.warning("Walert key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED else: - logger.info("Walert key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except Exception: - logger.info("Walert key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED if show_output: @@ -1854,7 +1812,6 @@ def check_glassnode_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_GLASSNODE_KEY == "REPLACE_ME": - logger.info("Glassnode key not defined") status = KeyStatus.NOT_DEFINED else: url = "https://api.glassnode.com/v1/metrics/market/price_usd_close" @@ -1869,7 +1826,6 @@ def check_glassnode_key(show_output: bool = False) -> str: r = request(url, params=parameters) if r.status_code == 200: - logger.info("Glassnode key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Glassnode key defined, test failed") @@ -1932,7 +1888,6 @@ def check_coinglass_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_COINGLASS_KEY == "REPLACE_ME": - logger.info("Coinglass key not defined") status = KeyStatus.NOT_DEFINED else: url = "https://open-api.coinglass.com/api/pro/v1/futures/openInterest/chart?&symbol=BTC&interval=0" @@ -1945,7 +1900,6 @@ def check_coinglass_key(show_output: bool = False) -> str: logger.warning("Coinglass key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif response.status_code == 200: - logger.info("Coinglass key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Coinglass key defined, test inconclusive") @@ -2006,7 +1960,6 @@ def check_cpanic_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_CRYPTO_PANIC_KEY == "REPLACE_ME": - logger.info("cpanic key not defined") status = KeyStatus.NOT_DEFINED else: crypto_panic_url = ( @@ -2016,7 +1969,6 @@ def check_cpanic_key(show_output: bool = False) -> str: response = request(crypto_panic_url) if response.status_code == 200: - logger.info("Cpanic key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Cpanic key defined, test failed") @@ -2079,7 +2031,6 @@ def check_ethplorer_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_ETHPLORER_KEY == "REPLACE_ME": - logger.info("ethplorer key not defined") status = KeyStatus.NOT_DEFINED else: ethplorer_url = "https://api.ethplorer.io/getTokenInfo/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984?apiKey=" @@ -2088,13 +2039,11 @@ def check_ethplorer_key(show_output: bool = False) -> str: try: response = request(ethplorer_url) if response.status_code == 200: - logger.info("ethplorer key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("ethplorer key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED except Exception as _: # noqa: F841 - logger.info("ethplorer key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED if show_output: @@ -2184,7 +2133,6 @@ def check_smartstake_key(show_output: bool = False) -> str: logger.warning("Smartstake key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif 200 <= response.status_code < 300: - logger.info("Smartstake key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Smartstake key defined, test inconclusive") @@ -2250,7 +2198,6 @@ def check_github_key(show_output: bool = False) -> str: if ( current_user.credentials.API_GITHUB_KEY == "REPLACE_ME" ): # pragma: allowlist secret - logger.info("GitHub key not defined") status = KeyStatus.NOT_DEFINED else: status = KeyStatus.DEFINED_NOT_TESTED @@ -2315,7 +2262,6 @@ def check_messari_key(show_output: bool = False) -> str: current_user.credentials.API_MESSARI_KEY == "REPLACE_ME" # pragma: allowlist secret ): # pragma: allowlist secret - logger.info("Messari key not defined") status = KeyStatus.NOT_DEFINED else: url = "https://data.messari.io/api/v2/assets/bitcoin/profile" @@ -2324,7 +2270,6 @@ def check_messari_key(show_output: bool = False) -> str: r = request(url, headers=headers, params=params) if r.status_code == 200: - logger.info("Messari key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Messari key defined, test failed") @@ -2385,7 +2330,6 @@ def check_eodhd_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_EODHD_KEY == "REPLACE_ME": # nosec - logger.info("End of Day Historical Data key not defined") status = KeyStatus.NOT_DEFINED else: request_url = ( @@ -2394,7 +2338,6 @@ def check_eodhd_key(show_output: bool = False) -> str: ) r = request(request_url) if r.status_code == 200: - logger.info("Eodhd key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Eodhd key defined, test failed") @@ -2457,7 +2400,6 @@ def check_santiment_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_SANTIMENT_KEY == "REPLACE_ME": - logger.info("santiment key not defined") status = KeyStatus.NOT_DEFINED else: headers = { @@ -2476,13 +2418,11 @@ def check_santiment_key(show_output: bool = False) -> str: ) try: if response.status_code == 200: - logger.info("santiment key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("santiment key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED except Exception as _: # noqa: F841 - logger.info("santiment key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED if show_output: @@ -2540,7 +2480,6 @@ def check_shroom_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_SHROOM_KEY == "REPLACE_ME": - logger.info("Shroom key not defined") status = KeyStatus.NOT_DEFINED else: try: @@ -2551,7 +2490,6 @@ def check_shroom_key(show_output: bool = False) -> str: ) if response.status_code == 400: # this is expected because shroom returns 400 when query is not passed - logger.info("Shroom key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED elif response.status_code == 401: logger.warning("Shroom key defined, test failed") @@ -2618,7 +2556,6 @@ def check_tokenterminal_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_TOKEN_TERMINAL_KEY == "REPLACE_ME": - logger.info("Token Terminal key not defined") status = KeyStatus.NOT_DEFINED else: token_terminal = TokenTerminal( @@ -2629,7 +2566,6 @@ def check_tokenterminal_key(show_output: bool = False) -> str: logger.warning("Token Terminal key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED else: - logger.info("Token Terminal key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED if show_output: @@ -2686,14 +2622,12 @@ def check_stocksera_key(show_output: bool = False): current_user = get_current_user() if current_user.credentials.API_STOCKSERA_KEY == "REPLACE_ME": - logger.info("Stocksera key not defined") status = KeyStatus.NOT_DEFINED else: client = stocksera.Client(api_key=current_user.credentials.API_STOCKSERA_KEY) try: client.borrowed_shares(ticker="AAPL") - logger.info("Stocksera key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED except Exception as _: # noqa: F841 logger.warning("Stocksera key defined, test failed") @@ -2753,7 +2687,6 @@ def check_intrinio_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_INTRINIO_KEY == "REPLACE_ME": - logger.info("Intrinio key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -2763,7 +2696,6 @@ def check_intrinio_key(show_output: bool = False) -> str: logger.warning("Intrinio key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("Intrinio key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Intrinio key defined, test inconclusive") @@ -2826,7 +2758,6 @@ def check_databento_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_DATABENTO_KEY == "REPLACE_ME": - logger.info("DataBento key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -2837,7 +2768,6 @@ def check_databento_key(show_output: bool = False) -> str: logger.warning("DataBento key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("DataBento key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("DataBento key defined, test inconclusive") @@ -2895,7 +2825,6 @@ def check_ultima_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_ULTIMA_KEY == "REPLACE_ME": - logger.info("Ultima Insights key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -2908,7 +2837,6 @@ def check_ultima_key(show_output: bool = False) -> str: logger.warning("Ultima Insights key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("Ultima Insights key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("Ultima Insights key defined, test inconclusive") @@ -2968,7 +2896,6 @@ def check_dappradar_key(show_output: bool = False) -> str: current_user = get_current_user() if current_user.credentials.API_DAPPRADAR_KEY == "REPLACE_ME": - logger.info("DappRadar key not defined") status = KeyStatus.NOT_DEFINED else: r = request( @@ -2979,7 +2906,6 @@ def check_dappradar_key(show_output: bool = False) -> str: logger.warning("DappRadar key defined, test failed") status = KeyStatus.DEFINED_TEST_FAILED elif r.status_code == 200: - logger.info("DappRadar key defined, test passed") status = KeyStatus.DEFINED_TEST_PASSED else: logger.warning("DappRadar key defined, test inconclusive") |