MCPcopy Index your code
hub / github.com/Codeplain-ai/codeplain / _check_connection

Function _check_connection

plain2code.py:143–161  ·  view source on GitHub ↗

Check API connectivity, validate API key and client version, and return the user email.

(codeplainAPI: codeplain_api.CodeplainAPI)

Source from the content-addressed store, hash-verified

141
142
143def _check_connection(codeplainAPI: codeplain_api.CodeplainAPI) -> Optional[str]:
144 """Check API connectivity, validate API key and client version, and return the user email."""
145 response = codeplainAPI.connection_check(system_config.client_version)
146
147 if not response.get("api_key_valid", False):
148 raise InvalidAPIKey(
149 "The provided API key is invalid. Please provide a valid API key using the CODEPLAIN_API_KEY environment variable "
150 "or the --api-key argument.\n"
151 )
152
153 if not response.get("client_version_valid", False):
154 min_version = response.get("min_client_version", "unknown")
155 raise OutdatedClientVersion(
156 "Outdated client version: "
157 f"Your client version ({system_config.client_version}) is outdated. Minimum required version is {min_version}. "
158 "Please update using: uv tool upgrade codeplain"
159 )
160
161 return response.get("user_email")
162
163
164def warn_if_acceptance_tests_without_conformance_script(plain_module, args) -> None:

Callers 1

renderFunction · 0.85

Calls 3

InvalidAPIKeyClass · 0.90
connection_checkMethod · 0.80

Tested by

no test coverage detected