> ## Documentation Index
> Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 获取 Secret

> 了解 PPIO Agent 沙箱 Secret 信息的获取方式，查阅相关资源的读取说明，为检查敏感配置资源与维护应用连接提供参考。

`ppio.secret.get()` 按名称获取活跃 Secret 的元数据。它返回 `SecretBinding` 元数据，不会返回真实值。可在从沙箱引用某个 Secret 之前，用它确认该 Secret 存在并检查其主机允许列表。

## 示例

该示例确保 Secret 存在，使用 `ppio.secret.get()` 获取其元数据，启动一个引用它的沙箱，在沙箱内使用占位符，并在完成后销毁沙箱。

```python Python theme={null}
from ppio_sandbox import PPIO

ppio = PPIO()

secret_name = "<your-secret-name>"

# 操作 Secret：按名称获取 Secret 元数据（不返回真实值）。
fetched = ppio.secret.get(secret_name)
print(fetched)
```

```javascript JavaScript & TypeScript theme={null}
import { PPIO } from 'ppio-sandbox'

const ppio = new PPIO()

const secretName = '<your-secret-name>'

const fetched = await ppio.secret.get(secretName)
console.log(fetched)
```

```bash CLI theme={null}
ppio secret get <secret_name>

# JSON 格式输出
ppio secret get <secret_name> --output json
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.