mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-04 16:32:10 +00:00
* remove sync and pull * ruff * remove runtime fetch configs * add comment * reset when logged * update translation yml file * sdk regen * print bold red messages if logout process fails * fix sources not being applied * handle bad json * update hub links * save terminal crash when sources file is broken * add user defaults to gitignore * actually no needed, will just be more specific about richstyle coming from hub * black * rewrite stdout * fix session_model tests * fix sdk session tests * move paths * remove duplicate line * fix user being reset in test_logout_user test * remove unecessary recording * change colors msg * remove repeated code
29 lines
657 B
Python
29 lines
657 B
Python
import json
|
|
from pathlib import Path
|
|
|
|
from openbb_terminal.core.config.paths import OPENBB_DATA_SOURCES_DEFAULT_FILE
|
|
|
|
|
|
def read_sources(path: Path) -> dict:
|
|
"""Read sources from file.
|
|
|
|
Parameters
|
|
----------
|
|
path : str
|
|
Path to file
|
|
|
|
Returns
|
|
-------
|
|
dict
|
|
Dictionary with sources
|
|
"""
|
|
try:
|
|
with open(path) as file:
|
|
return json.load(file)
|
|
except Exception as e:
|
|
print(f"\nFailed to read data sources file: " f"{path}\n{e}\n")
|
|
print("Using OpenBB defaults for guest mode.")
|
|
|
|
with open(OPENBB_DATA_SOURCES_DEFAULT_FILE) as file:
|
|
return json.load(file)
|