<?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 (requests.get) outputs only first 100 events in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-requests-get-outputs-only-first-100-events/m-p/530744#M9525</link>
    <description>&lt;P&gt;As soon as i posted this question, i found the answer.&lt;/P&gt;&lt;P&gt;Its indeed count = 0 the answer, as highlighted below.&lt;BR /&gt;Been struggling with this for 2 days. But answer is so simple.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;url = base_url + "/services/search/jobs/%s/results" % sid&lt;BR /&gt;headers = {&lt;BR /&gt;"content-type": "application/x-www-form-urlencoded",&lt;BR /&gt;"Authorization": "Splunk %s" % sessionkey&lt;BR /&gt;}&lt;BR /&gt;payload = {&lt;BR /&gt;&lt;BR /&gt;"output_mode": "json",&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"count": 0&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;res = requests.get(url, headers=headers, params=payload, verify = False)&lt;BR /&gt;result = json.loads(res.text)["results"]&lt;/P&gt;&lt;P&gt;print("length is %s" % len(result))&lt;/P&gt;</description>
    <pubDate>Wed, 25 Nov 2020 05:05:59 GMT</pubDate>
    <dc:creator>vamsigurram</dc:creator>
    <dc:date>2020-11-25T05:05:59Z</dc:date>
    <item>
      <title>Splunk-Python (requests.get) outputs only first 100 events</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-requests-get-outputs-only-first-100-events/m-p/530743#M9524</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wrote the below python code, which is giving me only first 100 events.&lt;/P&gt;&lt;P&gt;I checked online docs, i saw "count = 0" as a solution, to get all results, but that option only works for Splunk SDK (splunklib.client.service)&lt;/P&gt;&lt;P&gt;I am using python's requests library.&lt;/P&gt;&lt;P&gt;Need help in looping/pagination of all the results of this search id (%sid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import requests&lt;BR /&gt;import&amp;nbsp;json&lt;/P&gt;&lt;P&gt;url = base_url + "/services/search/jobs/%s/results" % sid&lt;BR /&gt;headers = {&lt;BR /&gt;"content-type": "application/x-www-form-urlencoded",&lt;BR /&gt;"Authorization": "Splunk %s" % sessionkey&lt;BR /&gt;}&lt;BR /&gt;payload = {&lt;BR /&gt;&lt;BR /&gt;"output_mode": "json"&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;res = requests.get(url, headers=headers, params=payload, verify = False)&lt;BR /&gt;result = json.loads(res.text)["results"]&lt;/P&gt;&lt;P&gt;print("length is %s" % len(result)) =================&amp;gt; Output here is 100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 04:50:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-requests-get-outputs-only-first-100-events/m-p/530743#M9524</guid>
      <dc:creator>vamsigurram</dc:creator>
      <dc:date>2020-11-25T04:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk-Python (requests.get) outputs only first 100 events</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-requests-get-outputs-only-first-100-events/m-p/530744#M9525</link>
      <description>&lt;P&gt;As soon as i posted this question, i found the answer.&lt;/P&gt;&lt;P&gt;Its indeed count = 0 the answer, as highlighted below.&lt;BR /&gt;Been struggling with this for 2 days. But answer is so simple.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;url = base_url + "/services/search/jobs/%s/results" % sid&lt;BR /&gt;headers = {&lt;BR /&gt;"content-type": "application/x-www-form-urlencoded",&lt;BR /&gt;"Authorization": "Splunk %s" % sessionkey&lt;BR /&gt;}&lt;BR /&gt;payload = {&lt;BR /&gt;&lt;BR /&gt;"output_mode": "json",&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"count": 0&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;res = requests.get(url, headers=headers, params=payload, verify = False)&lt;BR /&gt;result = json.loads(res.text)["results"]&lt;/P&gt;&lt;P&gt;print("length is %s" % len(result))&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 05:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Splunk-Python-requests-get-outputs-only-first-100-events/m-p/530744#M9525</guid>
      <dc:creator>vamsigurram</dc:creator>
      <dc:date>2020-11-25T05:05:59Z</dc:date>
    </item>
  </channel>
</rss>

