I tried both rr = results.ResultsReader(service.jobs.export(SEARCH_STRING, **{"output_mode": "CSV"})) and rr = results.ResultsReader(service.jobs.export(SEARCH_STRING, output_mode="CSV")). Both give me the following invalid format CSV error: Traceback (most recent call last): File "e:\Python_Projects\Payees\Code\get_splunk_sdk.py", line 43, in <module> rr = results.ResultsReader(service.jobs.export(SEARCH_STRING, **{"output_mode": "CSV"})) File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\client.py", line 2989, in export return self.post(path_segment="export", File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\client.py", line 821, in post return self.service.post(path, owner=owner, app=app, sharing=sharing, **query) File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\binding.py", line 290, in wrapper return request_fun(self, *args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\binding.py", line 71, in new_f val = f(*args, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\binding.py", line 764, in post response = self.http.post(path, all_headers, **query) File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\binding.py", line 1242, in post return self.request(url, message) File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\binding.py", line 1262, in request raise HTTPError(response) splunklib.binding.HTTPError: HTTP 400 Invalid output mode specified (CSV). -- Invalid output mode specified (CSV). If I try the following code: rr = results.ResultsReader(service.jobs.export(SEARCH_STRING, output_mode="csv")) for result in rr: print(result) It seems OK with "rr" statement, but gives me the following error: Traceback (most recent call last): File "e:\Python_Projects\Payees\Code\get_splunk_sdk.py", line 47, in <module> for result in rr: File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\results.py", line 210, in next return next(self._gen) File "C:\ProgramData\Anaconda3\lib\site-packages\splunklib\results.py", line 219, in _parse_results for event, elem in et.iterparse(stream, events=('start', 'end')): File "C:\ProgramData\Anaconda3\lib\xml\etree\ElementTree.py", line 1227, in iterator yield from pullparser.read_events() File "C:\ProgramData\Anaconda3\lib\xml\etree\ElementTree.py", line 1302, in read_events raise event File "C:\ProgramData\Anaconda3\lib\xml\etree\ElementTree.py", line 1274, in feed self._parser.feed(data) xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 6, column 101 I also tried to add "|outputcsv myoutput.csv" inside my SEARCH_STRING, I don't know where is its location on Windows Server 2016? By the way, your document is pretty hard to understand. Do you mind to give me direct answer next time? Thanks.
... View more