clear and patch

This commit is contained in:
Diogo Sousa
2023-02-01 10:41:00 +00:00
parent 61abf795c3
commit aaf0ea25ed
5 changed files with 13 additions and 8 deletions

View File

@@ -160,7 +160,7 @@ class AccountController(BaseController):
)
if i.lower() in ["y", "yes"]:
console.print("")
Hub.clear_user_configs()
Hub.clear_user_configs(auth_header=User.get_auth_header())
else:
console.print("\nAborted.", style="info")

View File

@@ -110,6 +110,7 @@ class FeatureFlagsController(BaseController):
key=name,
value=str(value),
type_="settings",
auth_header=User.get_auth_header(),
)
def call_overwrite(self, _):

View File

@@ -247,7 +247,12 @@ def set_key(env_var_name: str, env_var_value: str, persist: bool = False) -> Non
and env_var_name not in cfg.SENSITIVE_KEYS
and env_var_name.startswith("API_")
):
patch_user_configs(key=env_var_name, value=env_var_value, type_="keys")
patch_user_configs(
key=env_var_name,
value=env_var_value,
type_="keys",
auth_header=User.get_auth_header(),
)
def get_keys(show: bool = False) -> pd.DataFrame:

View File

@@ -194,7 +194,7 @@ def patch_user_configs(
type_ : str
The type of the patch, either "keys" or "settings".
auth_header : str
The authorization header.
The authorization header, e.g. "Bearer <token>".
base_url : str
The base url, by default BASE_URL
timeout : int
@@ -236,16 +236,16 @@ def patch_user_configs(
def clear_user_configs(
base_url: str = BASE_URL, auth_header: Optional[str] = None, timeout: int = TIMEOUT
auth_header: str, base_url: str = BASE_URL, timeout: int = TIMEOUT
) -> Optional[requests.Response]:
"""Clear user configurations to the server.
Parameters
----------
auth_header : str
The authorization header, e.g. "Bearer <token>".
base_url : str
The base url, by default BASE_URL
auth_header : Optional[str]
The authorization header, by default None
timeout : int
The timeout, by default TIMEOUT
@@ -254,8 +254,6 @@ def clear_user_configs(
Optional[requests.Response]
The response from the put request.
"""
auth_header = User.get_auth_header() if auth_header is None else auth_header
data: Dict[str, dict] = {"features_keys": {}, "features_settings": {}}
try:

View File

@@ -165,6 +165,7 @@ class SettingsController(BaseController):
key=name,
value=str(value),
type_="settings",
auth_header=User.get_auth_header(),
)
@log_start_end(log=logger)