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

# 腾讯云对象存储目录集成

> 使用 LangChain Python 与腾讯云 COS 目录文档加载器集成。

> [腾讯云对象存储（COS）](https://www.tencentcloud.com/products/cos) 是一项分布式存储服务，允许您通过 HTTP/HTTPS 协议从任何地方存储任意数量的数据。`COS` 对数据结构或格式没有限制。它也没有存储桶大小限制和分区管理，使其适用于几乎任何用例，例如数据分发、数据处理和数据湖。`COS` 提供基于 Web 的控制台、多语言 SDK 和 API、命令行工具以及图形工具。它与 Amazon S3 API 兼容，使您能够快速访问社区工具和插件。

本文介绍如何从 `腾讯云 COS 目录` 加载文档对象。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install -qU  cos-python-sdk-v5
```

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

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
conf = CosConfig(
    Region="您的 COS 区域",
    SecretId="您的 COS SecretId",
    SecretKey="您的 COS SecretKey",
)
loader = TencentCOSDirectoryLoader(conf=conf, bucket="您的 COS 存储桶")
```

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

## 指定前缀

您还可以指定一个前缀，以更精细地控制要加载的文件。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
loader = TencentCOSDirectoryLoader(conf=conf, bucket="您的 COS 存储桶", prefix="fake")
```

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

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档](/use-these-docs)通过 MCP 连接到 Claude、VSCode 等，以获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/document_loaders/tencent_cos_directory.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
