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 的实现及其回调处理,然后将所请求的行为与 issue 中的 .NET 示例进行比较。确定如何让暂停的迭代公开完成状态,并从当前位置继续;当 SDK 的行为及其用法得到明确定义和验证后,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- api
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100