cloudflare / cloudflare/cloudflare-python

`client.pages.projects.list` returns a paginated list of `Deployment`s instead of `Project`s

未关闭 适合新手
#2,692 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
506
派生
148
平均合并
3 小时 15 分钟
30 天内合并 PR
1

描述

### Confirm this is a Python library issue and not an underlying Cloudflare API issue.

- [x] This is an issue with the Python library

### Describe the bug

As the title says, `client.pages.projects.list` returns a paginated list of `Deployment`s instead of `Project`s.

### To Reproduce

Assertions should pass, but they fail.

```python
import cloudflare
from pydantic import BaseModel

class Config(BaseModel):
account_id: str
api_token: str

with open("config.json", "r") as f:
config = Config.model_validate_json(f.read())

client = cloudflare.Cloudflare(api_token=config.api_token)
for project in client.pages.projects.list(account_id=config.account_id):
assert not isinstance(project, cloudflare.types.pages.deployment.Deployment)
assert isinstance(project, cloudflare.types.pages.project.Project)
break
```

### Code snippets

```Python

```

### OS

Ubuntu 24.04

### Python version

3.12.3

### Library version

4.3.1

贡献指南

打开贡献指南

调研方向

从 client.pages.projects.list 开始,检查其分页结果的类型定义,以及这些结果是如何映射为 cloudflare.types.pages.deployment.Deployment 而不是 cloudflare.types.pages.project.Project 的。针对列出的库版本运行提供的 Python 复现,并确认每个结果都是 Project 而不是 Deployment。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
74/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。