Pagination on zero_trust.devices.list only returns 1 page
@vaishakdinesh is already working on this.
Since Jun 30, 2025.
Assessment
This issue has not been assessed yet.
Description
Confirm this is a Python library issue and not an underlying Cloudflare API issue.
- This is an issue with the Python library
Describe the bug
When using either the automatic pagination or the "has_next_page" manual pagination on the client.zero_trust.devices.list( endpoint, only 1 page is returned (20 devices).
The "has_next_page" function returns False.
This applies to async and non-async calls.
I can confirm that I have much more than 20 devices on the account, and the old API used to fetch them all.
This has been present in the lib for a while (months). I tried this lib out a while ago and found a few issues, but didn't get to reporting them then. I thought I'd mention that in case it helps narrow the issue down.
To Reproduce
- Try fetch all devices, either by automatic pagination or manual.
- Append to list
- Check length of list to find it's too short.
Code snippets
from cloudflare import Cloudflare
client = Cloudflare()
all_devices = []
for device in client.zero_trust.devices.list(account_id=***):
all_devices.append(device)
len(all_devices)
# In my case, outputs 20 instead of 91
OS
Ubuntu 24.04
Python version
3.12.3
Library version
v4.1.0
- Dominant language
- Python
- Stars
- 509
- Forks
- 150
- Avg merge
- 3h 15m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/cloudflare-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
cloudflare/cloudflare-python#2747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
cloudflare/cloudflare-python#2718 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
cloudflare/cloudflare-python#2692 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
cloudflare/cloudflare-python#2679 · 4 comments · 5 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
cloudflare/cloudflare-python#2745 · 1 comment ·
All issues in cloudflare/cloudflare-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100