> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Trello 集成

> 使用 LangChain Python 与 Trello 文档加载器集成。

> [Trello](https://www.atlassian.com/software/trello) 是一款基于网络的项目管理与协作工具，允许个人和团队组织并跟踪任务与项目。它提供了一个称为“看板”的可视化界面，用户可以在其中创建列表和卡片来表示任务和活动。

TrelloLoader 允许你从 Trello 看板加载卡片，其实现基于 [py-trello](https://pypi.org/project/py-trello/)。

目前仅支持 `api_key/token` 认证方式。

1. 凭证生成：[trello.com/power-ups/admin/](https://trello.com/power-ups/admin/)

2. 点击手动令牌生成链接以获取令牌。

要指定 API 密钥和令牌，你可以设置环境变量 `TRELLO_API_KEY` 和 `TRELLO_TOKEN`，或者直接将 `api_key` 和 `token` 传入 `from_credentials` 便捷构造方法。

此加载器允许你提供看板名称，以将对应的卡片拉取为 Document 对象。

请注意，看板的“名称”在官方文档中也称为“标题”：

[support.atlassian.com/trello/docs/changing-a-boards-title-and-description/](https://support.atlassian.com/trello/docs/changing-a-boards-title-and-description/)

你还可以指定多个加载参数，以在文档的 page\_content 属性和元数据中包含或排除不同字段。

## 功能特性

* 从 Trello 看板加载卡片。
* 根据卡片状态（打开或关闭）筛选卡片。
* 在加载的文档中包含卡片名称、评论和检查清单。
* 自定义要包含在文档中的额外元数据字段。

默认情况下，所有卡片字段都会包含在完整的文本 page\_content 和相应的元数据中。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install -qU  py-trello beautifulsoup4 lxml
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 如果你已经通过环境变量设置了 API 密钥和令牌，
# 可以跳过此单元格，并在下面的初始化步骤中注释掉
# `api_key` 和 `token` 命名参数。
from getpass import getpass

API_KEY = getpass()
TOKEN = getpass()
```

```text theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
········
········
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_community.document_loaders import TrelloLoader

# 从“Awesome Board”获取打开的卡片
loader = TrelloLoader.from_credentials(
    "Awesome Board",
    api_key=API_KEY,
    token=TOKEN,
    card_filter="open",
)
documents = loader.load()

print(documents[0].page_content)
print(documents[0].metadata)
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
Review Tech partner pages
Comments:
{'title': 'Review Tech partner pages', 'id': '6475357890dc8d17f73f2dcc', 'url': 'https://trello.com/c/b0OTZwkZ/1-review-tech-partner-pages', 'labels': ['Demand Marketing'], 'list': 'Done', 'closed': False, 'due_date': ''}
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 从“Awesome Board”获取所有卡片，但仅将
# 卡片列表（列）作为额外元数据包含。
loader = TrelloLoader.from_credentials(
    "Awesome Board",
    api_key=API_KEY,
    token=TOKEN,
    extra_metadata=("list"),
)
documents = loader.load()

print(documents[0].page_content)
print(documents[0].metadata)
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
Review Tech partner pages
Comments:
{'title': 'Review Tech partner pages', 'id': '6475357890dc8d17f73f2dcc', 'url': 'https://trello.com/c/b0OTZwkZ/1-review-tech-partner-pages', 'list': 'Done'}
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 从“Another Board”获取卡片，并从 Document 的 page_content 文本中
# 排除卡片名称、检查清单和评论。
loader = TrelloLoader.from_credentials(
    "test",
    api_key=API_KEY,
    token=TOKEN,
    include_card_name=False,
    include_checklist=False,
    include_comments=False,
)
documents = loader.load()

print("Document: " + documents[0].page_content)
print(documents[0].metadata)
```

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\oss\python\integrations\document_loaders\trello.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
