Skip to content

Commit 2e22d79

Browse files
authored
[Feature] Add Deprecation Warning For Account Module. (#7209)
* add deprecation warning to the account module * add docs link to warning
1 parent 1c6e084 commit 2e22d79

File tree

1 file changed

+17
-0
lines changed
  • openbb_platform/core/openbb_core/app/static

1 file changed

+17
-0
lines changed

openbb_platform/core/openbb_core/app/static/account.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# pylint: disable=W0212:protected-access
44
import json
5+
import logging
56
from functools import wraps
67
from pathlib import Path
78
from sys import exc_info
@@ -17,6 +18,18 @@
1718
if TYPE_CHECKING:
1819
from openbb_core.app.static.app_factory import BaseApp
1920

21+
logger = logging.getLogger(__name__)
22+
23+
logger.addHandler(logging.StreamHandler())
24+
logger.setLevel(logging.WARN)
25+
26+
27+
dep_warning = (
28+
"\nDeprecation Warning: The Account module is deprecated and will be removed in a future version."
29+
+ " Please migrate to using the `user_settings.json` file. For more information, visit:"
30+
+ " https://docs.openbb.co/platform/settings/user_settings/api_keys"
31+
)
32+
2033

2134
class Account: # noqa: D205, D400
2235
"""/account
@@ -123,6 +136,7 @@ def login(
123136
Optional[UserSettings]
124137
User settings: profile, credentials, preferences
125138
"""
139+
logger.warning(dep_warning)
126140
self._hub_service = self._create_hub_service(email, password, pat)
127141
incoming = self._hub_service.pull()
128142
self._base_app.user.profile = incoming.profile
@@ -161,6 +175,7 @@ def save(self, return_settings: bool = False) -> Optional[UserSettings]:
161175
Optional[UserSettings]
162176
User settings: profile, credentials, preferences
163177
"""
178+
logger.warning(dep_warning)
164179
if not self._hub_service:
165180
UserService.write_to_file(self._base_app._command_runner.user_settings)
166181
else:
@@ -184,6 +199,7 @@ def refresh(self, return_settings: bool = False) -> Optional[UserSettings]:
184199
Optional[UserSettings]
185200
User settings: profile, credentials, preferences
186201
"""
202+
logger.warning(dep_warning)
187203
if not self._hub_service:
188204
self._base_app._command_runner.user_settings = UserService.read_from_file()
189205
else:
@@ -210,6 +226,7 @@ def logout(self, return_settings: bool = False) -> Optional[UserSettings]:
210226
Optional[UserSettings]
211227
User settings: profile, credentials, preferences
212228
"""
229+
logger.warning(dep_warning)
213230
if not self._hub_service:
214231
raise OpenBBError("Not connected to hub.")
215232

0 commit comments

Comments
 (0)