client.rules.lists.items.list - Pagination not working
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Bắt đầu từ điểm vào client.rules.lists.items.list() và tái hiện vấn đề bằng ví dụ với một danh sách lớn hơn một trang. Kiểm tra cách xử lý phân trang và so sánh với thay đổi SyncCursorPagination được trích dẫn; được xem là hoàn tất khi việc lặp trả về tất cả các mục trong danh sách mà không yêu cầu giá trị per_page quá lớn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
Hi there,
It appears as though pagination is not working for client.rules.lists.items.list(). I am only getting the first page back. I've taken a look at the source code and it appears it could be related to the removal of SyncCursorPagination? I'm rusty as a dev so I wouldn't put money on it.
Please check out this PR though (here) which looks to have made a change. For now the list I have is around 480 items so I'm getting around this with client.rules.lists.items.list(account_id=account_id, list_id=rule_id, per_page=500) but this is a stop-gap solution at best.
See "To Reproduce" for a very basic reproduction.
Any help would be greatly appreciated!
To Reproduce
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
ip_list = []
rule_id = "xxxxx"
account_id = "xxxxx"
for item in client.rules.lists.items.list(list_id=rule_id, account_id=account_id):
ip_list.append(account)
print(ip_list)
Code snippets
OS
macOS
Python version
3.11.2
Library version
4.3.1
- Ngôn ngữ chính
- Python
- Star
- 509
- Fork
- 150
- Merge trung bình
- 3 giờ 15 phút
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cloudflare/cloudflare-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
cloudflare/cloudflare-python#2747 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
cloudflare/cloudflare-python#2718 · 1 bình luận ·
-
`client.pages.projects.list` returns a paginated list of `Deployment`s instead of `Project`s Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
cloudflare/cloudflare-python#2692 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
cloudflare/cloudflare-python#2679 · 4 bình luận · 5 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
cloudflare/cloudflare-python#2745 · 1 bình luận ·
Tất cả issue của cloudflare/cloudflare-python
Issue tương tự
-
documentation help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
simonw/sqlite-utils#872 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100