Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

JSONResultsReader iterator called on oneshot search does not iterate with for loop. #678

Copy link
Copy link
@jerryeblades

Description

@jerryeblades
Issue body actions

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)
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.