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

Method get_api_key

codewiki/cli/config_manager.py:248–264  ·  view source on GitHub ↗

Get API key from keyring or fallback file. Returns: API key or None if not set

(self)

Source from the content-addressed store, hash-verified

246 CREDENTIALS_FILE,
247 )
248 else:
249 self._save_api_key_to_file(api_key)
250
251 # Save non-sensitive config to JSON
252 config_data = {"version": CONFIG_VERSION, **self._config.to_dict()}
253
254 try:
255 safe_write(CONFIG_FILE, json.dumps(config_data, indent=2))
256 except FileSystemError as e:
257 raise ConfigurationError(f"Failed to save configuration: {e}")
258
259 def get_api_key(self) -> Optional[str]:
260 """
261 Get API key from keyring or fallback file.
262
263 Returns:
264 API key or None if not set
265 """
266 if self._api_key is None:
267 if self._keyring_available:

Callers 5

is_configuredMethod · 0.95
config_showFunction · 0.95
config_validateFunction · 0.95
generate_commandFunction · 0.95
_legacy_generate_docsFunction · 0.80

Calls 1

Tested by

no test coverage detected