diff --git a/docs/results.rst b/docs/results.rst index 571fba1f..007e881c 100644 --- a/docs/results.rst +++ b/docs/results.rst @@ -5,4 +5,4 @@ splunklib.results .. autoclass:: Message -.. autoclass:: ResultsReader +.. autoclass:: JSONResultsReader diff --git a/splunklib/binding.py b/splunklib/binding.py index 238ab0fd..bb4cfeb7 100644 --- a/splunklib/binding.py +++ b/splunklib/binding.py @@ -799,9 +799,6 @@ def request(self, path_segment, method="GET", headers=None, body={}, :type app: ``string`` :param sharing: The sharing mode of the namespace (optional). :type sharing: ``string`` - :param query: All other keyword arguments, which are used as query - parameters. - :type query: ``string`` :return: The response from the server. :rtype: ``dict`` with keys ``body``, ``headers``, ``reason``, and ``status`` diff --git a/splunklib/client.py b/splunklib/client.py index cadc4105..b839d7f2 100644 --- a/splunklib/client.py +++ b/splunklib/client.py @@ -3018,7 +3018,7 @@ def itemmeta(self): def oneshot(self, query, **params): """Run a oneshot search and returns a streaming handle to the results. - The ``InputStream`` object streams XML fragments from the server. To parse this stream into usable Python + The ``InputStream`` object streams fragments from the server. To parse this stream into usable Python objects, pass the handle to :class:`splunklib.results.JSONResultsReader` along with the query param "output_mode='json'" :: diff --git a/splunklib/results.py b/splunklib/results.py index 5f396685..8543ab0d 100644 --- a/splunklib/results.py +++ b/splunklib/results.py @@ -23,7 +23,7 @@ accessing search results while avoiding buffering the result set, which can be very large. -To use the reader, instantiate :class:`ResultsReader` on a search result stream +To use the reader, instantiate :class:`JSONResultsReader` on a search result stream as follows::: reader = ResultsReader(result_stream) @@ -55,7 +55,8 @@ __all__ = [ "ResultsReader", - "Message" + "Message", + "JSONResultsReader" ] @@ -308,11 +309,14 @@ class JSONResultsReader(object): :class:`Message` object for Splunk messages. This class has one field, ``is_preview``, which is ``True`` when the results are a preview from a running search, or ``False`` when the results are from a completed search. + This function has no network activity other than what is implicit in the stream it operates on. - :param `stream`: The stream to read from (any object that supports - ``.read()``). + + :param `stream`: The stream to read from (any object that supports``.read()``). + **Example**:: + import results response = ... # the body of an HTTP response reader = results.JSONResultsReader(response)