Skip to content

Commit 10aacfd

Browse files
avoid error throwing duplication during 403 respoinse for invalid API key
1 parent a37f599 commit 10aacfd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

codeflash/api/cfapi.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ def get_user_id(api_key: Optional[str] = None) -> Optional[str]:
9999
return None
100100

101101
response = make_cfapi_request(
102-
endpoint="/cli-get-user", method="GET", extra_headers={"cli_version": __version__}, api_key=api_key
102+
endpoint="/cli-get-user",
103+
method="GET",
104+
extra_headers={"cli_version": __version__},
105+
api_key=api_key,
106+
suppress_errors=True,
103107
)
104108
if response.status_code == 200:
105109
if "min_version" not in response.text:
@@ -131,7 +135,6 @@ def get_user_id(api_key: Optional[str] = None) -> Optional[str]:
131135
"or\n"
132136
"https://docs.codeflash.ai/optimizing-with-codeflash/codeflash-github-actions#automated-setup-recommended"
133137
)
134-
logger.error(f"Failed to look up your userid; is your CF API key valid? ({response.reason})")
135138
exit_with_message(msg, error_on_exit=True)
136139

137140
# For other errors, log and return None (backward compatibility)

0 commit comments

Comments
 (0)