JSONResultsReader iterator called on oneshot search does not iterate with for loop.
还没有人认领这个 Issue。
评估
调研方向
Start by reproducing the provided JSONResultsReader snippet with both oneshot and normal searches, then inspect the JSONResultsReader iterator entry point and any existing tests. Done means a reader from a oneshot search supports direct for-loop iteration without first converting it to a list, with coverage for the differing search modes.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
JSONResultsReader iterator called on oneshot search does not iterate with for loop.
To Reproduce
-run a oneshot search, the notice the for content/command[s] fails.
reader = JSONResultsReader(result_stream)
for item in reader:
print(item)
Expected behavior
iterate through the results and take action on.
Logs or Screenshots
If applicable, add logs or screenshots to help explain your problem.
Splunk (please complete the following information):
- Version: Splunk Enterprise 9.1.1
- OS: Rocky Linux 9.6
- Deployment: Distributed/Clustered SH's and IDX's architecture
SDK (please complete the following information):
- Version: [2.1.0 and 2.1.1]
- Language Runtime Version: Python 3.12.3
- OS: Ubuntu 24.04.2 LTS
Additional context
This issue is only impacting the "oneshot" type search, with "normal" type search successfully yields an iterable "reader" for reader = JSONResultsReader(result_stream).
The workaround is to do:
reader = JSONResultsReader(result_stream)
reader2 = list(reader)
for item in reader2:
print(item)
- 主要语言
- Python
- 星标
- 743
- 派生
- 387
- 平均合并
- 42 分钟
- 30 天内合并 PR
- 4
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
splunk/splunk-sdk-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
splunk/splunk-sdk-python#835 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 74/100
splunk/splunk-sdk-python#831 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
splunk/splunk-sdk-python#704 ·
-
难度 5/5 一周以上 新手友好度 30/100
splunk/splunk-sdk-python#840 ·
-
难度 3/5 1-2 天 新手友好度 74/100
splunk/splunk-sdk-python#828 ·
查看 splunk/splunk-sdk-python 的全部 Issue
相似的 Issue
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 90/100
simonw/sqlite-utils#872 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 78/100