> ## 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.

# Dropbox 集成

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

[Dropbox](https://en.wikipedia.org/wiki/Dropbox) 是一个文件托管服务，它将传统文件、云内容和网页快捷方式整合在一个地方。

本笔记本介绍了如何从 *Dropbox* 加载文档。除了常见的文本和 PDF 文件外，它还支持 *Dropbox Paper* 文件。

## 前提条件

1. 创建一个 Dropbox 应用。
2. 为应用授予以下范围权限：`files.metadata.read` 和 `files.content.read`。
3. 生成访问令牌：[www.dropbox.com/developers/apps/create](https://www.dropbox.com/developers/apps/create)。
4. `pip install dropbox`（对于 PDF 文件类型，需要 `pip install "unstructured[pdf]"`）。

## 使用说明

`DropboxLoader` 要求你创建一个 Dropbox 应用并生成访问令牌。这可以通过 [www.dropbox.com/developers/apps/create](https://www.dropbox.com/developers/apps/create) 完成。你还需要安装 Dropbox Python SDK（pip install dropbox）。

DropboxLoader 可以从 Dropbox 文件路径列表或单个 Dropbox 文件夹路径加载数据。这两个路径都应该是相对于与访问令牌关联的 Dropbox 账户根目录的。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install dropbox
```

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

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# 生成访问令牌：https://www.dropbox.com/developers/apps/create。
dropbox_access_token = "<DROPBOX_ACCESS_TOKEN>"
# Dropbox 根文件夹
dropbox_folder_path = ""
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
loader = DropboxLoader(
    dropbox_access_token=dropbox_access_token,
    dropbox_folder_path=dropbox_folder_path,
    recursive=False,
)
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
documents = loader.load()
```

```text theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
文件 /JHSfLKn0.jpeg 无法解码为文本。已跳过。
文件 /A REPORT ON WILES’ CAMBRIDGE LECTURES.pdf 无法解码为文本。已跳过。
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
for document in documents:
    print(document)
```

***

<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\dropbox.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>
