<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Splunk Python SDKm cannot get results from a query in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-SDKm-cannot-get-results-from-a-query/m-p/415918#M7248</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;It looks like you are hitting same issue as explained in question &lt;A href="https://answers.splunk.com/answers/691052/why-are-our-splunk-python-sdk-query-results-empty.html"&gt;https://answers.splunk.com/answers/691052/why-are-our-splunk-python-sdk-query-results-empty.html&lt;/A&gt; , try with &lt;CODE&gt;sleep(5)&lt;/CODE&gt; after &lt;CODE&gt;print("Job is not ready")&lt;/CODE&gt; line in while loop.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Oct 2018 12:30:48 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2018-10-18T12:30:48Z</dc:date>
    <item>
      <title>Splunk Python SDKm cannot get results from a query</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-SDKm-cannot-get-results-from-a-query/m-p/415917#M7247</link>
      <description>&lt;P&gt;I'm using the latest Python SDK to send some requests to splunk, since i need to obtain those data from a script.&lt;BR /&gt;
Somehow I'm unable to get the data, and the request is not failing, That says everything seems to be correctly working, but no results is returned.&lt;BR /&gt;
I'm using exactly the same username/password combination as for the web login, sending the same request, From the web search, i get many thousands of results, but from the Python script, 0. This is the code snippet:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;searchquery_normal = "search index=testing_cc_ps  sourcetype=doors_as"
kwargs_normalsearch = {"earliest_time": "@d",
                       "latest_time": "now",
                       "exec_mode": "blocking"}
job = splunk_service.jobs.create(searchquery_normal, **kwargs_normalsearch)

# A normal search returns the job's SID right away, so we need to poll for completion
while True:
    while not job.is_ready():
        print("Job is not ready")
        pass
    stats = {"isDone": job["isDone"],
             "doneProgress": float(job["doneProgress"]) * 100,
             "scanCount": int(job["scanCount"]),
             "eventCount": int(job["eventCount"]),
             "resultCount": int(job["resultCount"])}

    status = ("\r%(doneProgress)03.1f%%   %(scanCount)d scanned   "
              "%(eventCount)d matched   %(resultCount)d results") % stats

    sys.stdout.write(status)
    sys.stdout.flush()
    if stats["isDone"] == "1":
        sys.stdout.write("\n\nDone!\n\n")
        break
    sleep(2)

# Get the results and display them
for result in results.ResultsReader(job.results()):
    print(result)

job.cancel()
sys.stdout.write('\n')
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That is the output&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;100.0%   0 scanned   0 matched   0 results &lt;BR /&gt;
Done!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Oct 2018 09:33:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-SDKm-cannot-get-results-from-a-query/m-p/415917#M7247</guid>
      <dc:creator>dfofie</dc:creator>
      <dc:date>2018-10-12T09:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Python SDKm cannot get results from a query</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-SDKm-cannot-get-results-from-a-query/m-p/415918#M7248</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;It looks like you are hitting same issue as explained in question &lt;A href="https://answers.splunk.com/answers/691052/why-are-our-splunk-python-sdk-query-results-empty.html"&gt;https://answers.splunk.com/answers/691052/why-are-our-splunk-python-sdk-query-results-empty.html&lt;/A&gt; , try with &lt;CODE&gt;sleep(5)&lt;/CODE&gt; after &lt;CODE&gt;print("Job is not ready")&lt;/CODE&gt; line in while loop.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 12:30:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-SDKm-cannot-get-results-from-a-query/m-p/415918#M7248</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-18T12:30:48Z</dc:date>
    </item>
  </channel>
</rss>

