client.rules.lists.items.list - Pagination not working
まだ誰も着手していません。
評価
調査の方向性
client.rules.lists.items.list() エントリポイントから始め、1ページを超えるリストを使った例で問題を再現します。ページネーションの処理を調査し、引用されている SyncCursorPagination の変更と比較します。per_page に過大な値を指定しなくても反復処理ですべてのリスト項目が返されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 509
- フォーク
- 150
- 平均マージ
- 3時間 15分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudflare/cloudflare-python のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
cloudflare/cloudflare-python#2747 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
cloudflare/cloudflare-python#2718 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
cloudflare/cloudflare-python#2692 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
cloudflare/cloudflare-python#2679 · コメント 4 件 · リアクション 5 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
cloudflare/cloudflare-python#2745 · コメント 1 件 ·
cloudflare/cloudflare-python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100