MCPcopy Create free account
hub / github.com/su-kaka/gcli2api / get_credential

Method get_credential

src/storage/psql_manager.py:382–398  ·  view source on GitHub ↗

获取凭证数据

(self, filename: str, mode: str = "geminicli")

Source from the content-addressed store, hash-verified

380 return False
381
382 async def get_credential(self, filename: str, mode: str = "geminicli") -> Optional[Dict[str, Any]]:
383 """获取凭证数据"""
384 self._ensure_initialized()
385 filename = os.path.basename(filename)
386
387 try:
388 table_name = self._get_table_name(mode)
389 async with self._pool.acquire() as conn:
390 row = await conn.fetchrow(
391 f"SELECT credential_data FROM {table_name} WHERE filename = $1", filename
392 )
393 if row:
394 return json.loads(row["credential_data"])
395 return None
396 except Exception as e:
397 log.error(f"Error getting credential {filename}: {e}")
398 return None
399
400 async def list_credentials(self, mode: str = "geminicli") -> List[str]:
401 """列出所有凭证文件名(包括禁用的)"""

Callers 10

fetch_user_email_commonFunction · 0.45
get_cred_detailFunction · 0.45
creds_actionFunction · 0.45
creds_batch_actionFunction · 0.45
download_cred_fileFunction · 0.45
get_credential_quotaFunction · 0.45
test_credentialFunction · 0.45

Calls 3

_ensure_initializedMethod · 0.95
_get_table_nameMethod · 0.95
errorMethod · 0.80

Tested by 1

test_credentialFunction · 0.36