JSONResultsReader iterator called on oneshot search does not iterate with for loop.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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)
- Dominant language
- Python
- Stars
- 743
- Forks
- 387
- Avg merge
- 42m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from splunk/splunk-sdk-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
splunk/splunk-sdk-python#835 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
splunk/splunk-sdk-python#831 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
splunk/splunk-sdk-python#704 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
splunk/splunk-sdk-python#840 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 74/100
splunk/splunk-sdk-python#828 ·
All issues in splunk/splunk-sdk-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100