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

# 华为云 OBS

> 配置华为云 OBS 对象存储数据源

## 华为云 OBS

华为云 OBS（Object Storage Service）兼容 S3 协议。

### 如何获取鉴权参数

1. 登录 [华为云控制台](https://console.huaweicloud.com/)
2. 进入对象存储服务（OBS），创建存储桶
   ![创建存储桶](https://static.textin.com/docs/images/pipeline/obs-bucket-create.png)
3. 获取访问密钥：
   * 进入"统一身份认证服务（IAM）" → "用户" → 创建用户或使用现有用户
     ![创建用户](https://static.textin.com/docs/images/pipeline/obs-create-user.png)
   * 为用户创建访问密钥，获取 `Access Key ID` 和 `Secret Access Key`
     ![创建访问密钥](https://static.textin.com/docs/images/pipeline/obs-create-accesskey.png)
   * 为用户授予 OBS 读取权限，至少包括：
     * `HeadBucket`：检查存储桶是否存在
     * `ListBucket`：列出存储桶中的对象
     * `GetObject`：获取对象内容
       ![授予权限](https://static.textin.com/docs/images/pipeline/obs-create-auth.png)
       ![授予权限](https://static.textin.com/docs/images/pipeline/obs-user-authorize.png)
4. 获取 OBS 端点：
   * 在存储桶概览页查看"Endpoint"
   * 格式：`https://obs.{region}.myhuaweicloud.com`
   * 例如：`https://obs.cn-east-3.myhuaweicloud.com`
     ![获取端点](https://static.textin.com/docs/images/pipeline/obs-get-endpoint.png)

### 配置示例

```python theme={null}
source = S3Source(
    endpoint='https://obs.cn-east-3.myhuaweicloud.com',
    access_key='your-access-key-id',
    secret_key='your-secret-access-key',
    bucket='your-bucket-name',
    prefix='documents/',  # 可选
    region='cn-east-3'
)
```

### 使用示例

```python theme={null}
from xparse_client import S3Source, Pipeline

source = S3Source(
    endpoint='https://obs.cn-east-3.myhuaweicloud.com',
    access_key='your-access-key-id',
    secret_key='your-secret-access-key',
    bucket='my-documents',
    prefix='pdfs/',
    region='cn-east-3'
)

# ... 其他配置

pipeline = Pipeline(
    source=source,
    # ...其他配置
)
pipeline.run()
```

### 参考文档

华为云 OBS 支持 S3 协议兼容，具体配置请参考华为云官方文档。
