From f07d116f23f3dfc51a98edd82c5ea0953dc695a5 Mon Sep 17 00:00:00 2001 From: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Date: Thu, 17 Aug 2023 09:18:26 -0700 Subject: [PATCH] Fixed URL for uploading to the hub (#5340) * Fixed URLs * Added a fix --- openbb_terminal/core/session/hub_model.py | 5 +---- openbb_terminal/settings_controller.py | 9 +++------ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/openbb_terminal/core/session/hub_model.py b/openbb_terminal/core/session/hub_model.py index 8c711b10d07..1103cb18682 100644 --- a/openbb_terminal/core/session/hub_model.py +++ b/openbb_terminal/core/session/hub_model.py @@ -375,7 +375,6 @@ def upload_config( value: str, type_: Literal["settings", "terminal_style"], auth_header: str, - base_url: str = BackendEnvironment.BASE_URL, timeout: int = TIMEOUT, ) -> Optional[requests.Response]: """Patch user configurations to the server. @@ -390,8 +389,6 @@ def upload_config( The type of the patch. auth_header : str The authorization header, e.g. "Bearer ". - base_url : str - The base url, by default BASE_URL timeout : int The timeout, by default TIMEOUT @@ -409,7 +406,7 @@ def upload_config( try: console.print("Sending to OpenBB hub...") response = requests.patch( - url=base_url + "terminal/user", + url=BackendEnvironment.BASE_URL + "terminal/user", headers={"Authorization": auth_header}, json=data, timeout=timeout, diff --git a/openbb_terminal/settings_controller.py b/openbb_terminal/settings_controller.py index 4ba909c0021..d1aa82d4132 100644 --- a/openbb_terminal/settings_controller.py +++ b/openbb_terminal/settings_controller.py @@ -231,7 +231,7 @@ class SettingsController(BaseController): " Then, place the downloaded file 'openbb_config.richstyle.json'" f" inside {get_current_user().preferences.USER_STYLES_DIRECTORY} or " f"{STYLES_DIRECTORY_REPO}. If you have a hub account you can change colors " - f"here {BackendEnvironment.HUB_URL + 'app/terminal/theme'}.", + f"here {BackendEnvironment.BASE_URL + 'app/terminal/theme'}.", ) if other_args and "-" not in other_args[0][0]: other_args.insert(0, "-s") @@ -246,7 +246,6 @@ class SettingsController(BaseController): value=ns_parser.style, type_="settings", auth_header=get_current_user().profile.get_auth_header(), - base_url=BackendEnvironment.HUB_URL, ) console.print("") console.print("Colors updated.") @@ -267,7 +266,7 @@ class SettingsController(BaseController): dest="style", choices=["dark", "light"], help="Choose chart style. If you have a hub account you can change theme " - f"here {BackendEnvironment.HUB_URL + 'app/terminal/theme/charts-tables'}.", + f"here {BackendEnvironment.BASE_URL + 'app/terminal/theme/charts-tables'}.", required="-h" not in other_args and "--help" not in other_args, ) if other_args and "-" not in other_args[0][0]: @@ -283,7 +282,6 @@ class SettingsController(BaseController): value=ns_parser.style, type_="terminal_style", auth_header=get_current_user().profile.get_auth_header(), - base_url=BackendEnvironment.HUB_URL, ) console.print("") theme.apply_style(ns_parser.style) @@ -305,7 +303,7 @@ class SettingsController(BaseController): dest="style", choices=["dark", "light"], help="Choose table style. If you have a hub account you can change theme " - f"here {BackendEnvironment.HUB_URL + 'app/terminal/theme/charts-tables'}.", + f"here {BackendEnvironment.BASE_URL + 'app/terminal/theme/charts-tables'}.", required="-h" not in other_args and "--help" not in other_args, ) if other_args and "-" not in other_args[0][0]: @@ -321,7 +319,6 @@ class SettingsController(BaseController): value=ns_parser.style, type_="terminal_style", auth_header=get_current_user().profile.get_auth_header(), - base_url=BackendEnvironment.HUB_URL, ) console.print("") console.print("Table theme updated.\n")