splunk / splunk/splunk-sdk-python
JSONResultsReader iterator called on oneshot search does not iterate with for loop.
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 743
- Forks
- 387
- Merge medio
- 42 min
- PR fusionados (30 d)
- 4
Descripción
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)
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100