microsoftgraph / microsoftgraph/msgraph-sdk-python-core
Unclear how to resume iterating with `PageIterator` if the callback returns `False`
未關閉
還沒有人認領這個 Issue。
bug
priority:p2
- 主要語言
- Python
- 星號
- 288
- 分支
- 52
- 平均合併
- 8 小時 10 分鐘
- 30 天內合併 PR
- 1
描述
In other SDKs, the iterator class typically has a Resume method to restart the iteration where it left off, and a corresponding State property to check if the iterator has completed or not. For example, in .NET:
var pageIterator = PageIterator<Message, MessageCollectionResponse>
.CreatePageIterator(
graphClient,
messages,
(msg) =>
{
Console.WriteLine(msg.Subject);
count++;
// If we've iterated over the limit,
// stop the iteration by returning false
return count < pauseAfter;
});
await pageIterator.IterateAsync();
while (pageIterator.State != PagingState.Complete)
{
Console.WriteLine("Iteration paused for 5 seconds...");
await Task.Delay(5000);
// Reset count
count = 0;
await pageIterator.ResumeAsync();
}
Is there a way to do this in this SDK?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先閱讀 PageIterator 的實作及其 callback 處理方式,接著將要求的行為與 issue 中的 .NET 範例進行比較。判斷暫停的反覆運算如何公開完成狀態,並從目前位置繼續;當 SDK 的行為及其使用方式獲得明確定義與驗證後,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- api
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100