This commit is contained in:
Diogo Sousa
2023-01-20 19:35:58 +00:00
parent 8ce990e39c
commit 90f135cd53
2 changed files with 12 additions and 2 deletions

View File

@@ -36,8 +36,8 @@ def remove_login_file() -> Union[Success, Failure]:
Returns
-------
Success
The status of the local logout.
Union[Success, Failure]
The status of the file removal, or an error.
"""
try:
@@ -45,6 +45,7 @@ def remove_login_file() -> Union[Success, Failure]:
if os.path.isfile(file_path):
os.remove(file_path)
return Success("[green]\nRemoved login info.[/green]")
return Success()
except Exception:
return Failure("[red]\nFailed to remove login file.[/red]")

View File

@@ -35,6 +35,7 @@ from openbb_terminal.rich_config import console
from openbb_terminal.terminal_helper import suppress_stdout
from openbb_terminal.portfolio.brokers.degiro.degiro_model import DegiroModel
from openbb_terminal.account.sync_model import put_user_configs
logger = logging.getLogger(__name__)
@@ -237,6 +238,14 @@ def set_key(env_var_name: str, env_var_value: str, persist: bool = False) -> Non
# Set cfg.env_var_name = env_var_value
setattr(cfg, env_var_name, env_var_value)
# Just for testing, replace when patch is available,
# this overwrites the whole config dict
data = {
"features_settings": {},
"features_keys": {env_var_name: env_var_value},
}
put_user_configs(data)
def get_keys(show: bool = False) -> pd.DataFrame:
"""Get currently set API keys.