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)