MCPcopy
hub / github.com/FujiwaraChoki/MoneyPrinterV2 / get_accounts

Function get_accounts

src/cache.py:63–92  ·  view source on GitHub ↗

Gets the accounts from the cache. Args: provider (str): The provider to get the accounts for Returns: account (List[dict]): The accounts

(provider: str)

Source from the content-addressed store, hash-verified

61 raise ValueError(f"Unsupported provider '{provider}'. Expected 'twitter' or 'youtube'.")
62
63def get_accounts(provider: str) -> List[dict]:
64 """
65 Gets the accounts from the cache.
66
67 Args:
68 provider (str): The provider to get the accounts for
69
70 Returns:
71 account (List[dict]): The accounts
72 """
73 cache_path = get_provider_cache_path(provider)
74
75 if not os.path.exists(cache_path):
76 # Create the cache file
77 with open(cache_path, 'w') as file:
78 json.dump({
79 "accounts": []
80 }, file, indent=4)
81
82 with open(cache_path, 'r') as file:
83 parsed = json.load(file)
84
85 if parsed is None:
86 return []
87
88 if 'accounts' not in parsed:
89 return []
90
91 # Get accounts dictionary
92 return parsed['accounts']
93
94def add_account(provider: str, account: dict) -> None:
95 """

Callers 4

mainFunction · 0.90
add_accountFunction · 0.85
remove_accountFunction · 0.85
mainFunction · 0.85

Calls 1

get_provider_cache_pathFunction · 0.85

Tested by

no test coverage detected