MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / validate_api_key

Function validate_api_key

codewiki/cli/utils/validation.py:55–79  ·  view source on GitHub ↗

Validate API key format. Args: api_key: API key to validate min_length: Minimum key length Returns: Validated API key Raises: ConfigurationError: If API key is invalid

(api_key: str, min_length: int = 10)

Source from the content-addressed store, hash-verified

53 """
54 Validate API key format.
55
56 Args:
57 api_key: API key to validate
58 min_length: Minimum key length
59
60 Returns:
61 Validated API key
62
63 Raises:
64 ConfigurationError: If API key is invalid
65 """
66 if not api_key or not api_key.strip():
67 raise ConfigurationError("API key cannot be empty")
68
69 api_key = api_key.strip()
70
71 if len(api_key) < min_length:
72 raise ConfigurationError(f"API key too short (minimum {min_length} characters)")
73
74 return api_key
75
76
77def validate_model_name(model: str) -> str:
78 """
79 Validate model name format.
80
81 Args:
82 model: Model name to validate

Callers 1

config_setFunction · 0.90

Calls 1

ConfigurationErrorClass · 0.90

Tested by

no test coverage detected