<?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: Is it possible to use a token for python SDK? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442889#M29199</link>
    <description>&lt;P&gt;Is there some reserve name to use with the username like with GitHub access Tokens? What I've tried so far hasn't worked.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jul 2019 16:15:01 GMT</pubDate>
    <dc:creator>EricWehrly</dc:creator>
    <dc:date>2019-07-01T16:15:01Z</dc:date>
    <item>
      <title>Is it possible to use a token for python SDK?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442887#M29197</link>
      <description>&lt;P&gt;I have an authentication token which I have found success using curls and the REST API with Splunk Cloud.&lt;/P&gt;

&lt;P&gt;I'm trying to drop limited log events from a python application in AWS. &lt;BR /&gt;
All of the documentation that I can find discusses using username and password with the python SDK client.&lt;BR /&gt;
But I don't have that.&lt;/P&gt;

&lt;P&gt;I could use the underlying requests python lib, but I'd rather leave as little room for me screwing up the JSON objects as I can.&lt;/P&gt;

&lt;P&gt;Could you please provide an example of using the python SDK client with the kind of token that would be passed to the REST API in an Authorization header?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2019 15:58:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442887#M29197</guid>
      <dc:creator>EricWehrly</dc:creator>
      <dc:date>2019-06-26T15:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use a token for python SDK?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442888#M29198</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Have a look at script on &lt;A href="https://answers.splunk.com/answers/688049/how-do-i-alter-propsconf-via-python-sdk.html"&gt;https://answers.splunk.com/answers/688049/how-do-i-alter-propsconf-via-python-sdk.html&lt;/A&gt; , you need to supply username and password when you invoke script or initiate connection to Splunk management port. Once you authenticate successfully then you can use &lt;CODE&gt;sessionkey&lt;/CODE&gt; to fire multiple REST API in same script.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 08:20:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442888#M29198</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-06-27T08:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use a token for python SDK?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442889#M29199</link>
      <description>&lt;P&gt;Is there some reserve name to use with the username like with GitHub access Tokens? What I've tried so far hasn't worked.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 16:15:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442889#M29199</guid>
      <dc:creator>EricWehrly</dc:creator>
      <dc:date>2019-07-01T16:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use a token for python SDK?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442890#M29200</link>
      <description>&lt;P&gt;IIRC Splunk allows token authentication since Splunk 7.3 but I didn't test this yet. &lt;/P&gt;

&lt;P&gt;Have a look at &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.0/Security/CreateAuthTokens"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.0/Security/CreateAuthTokens&lt;/A&gt; to create new token and &lt;A href="https://docs.splunk.com/Documentation/Splunk/7.3.0/Security/UseAuthTokens"&gt;https://docs.splunk.com/Documentation/Splunk/7.3.0/Security/UseAuthTokens&lt;/A&gt; to use tockens in REST calls.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:00:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442890#M29200</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2019-07-02T10:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use a token for python SDK?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442891#M29201</link>
      <description>&lt;P&gt;No.&lt;BR /&gt;
Answer appears to be "no", if all your organization provides is a token, you need to finnick with low-level request api. No SDK.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 13:53:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442891#M29201</guid>
      <dc:creator>EricWehrly</dc:creator>
      <dc:date>2019-07-02T13:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use a token for python SDK?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442892#M29202</link>
      <description>&lt;P&gt;Currently (March 2020), you can pass splunkToken with the value of a token instead of passing a username and password to Splunk connect.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;service = client.connect(user='admin', password='changeme' [...])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;becomes&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;service = client.connect(splunkToken='sllRek...', [...])
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have tested this while running searches via the Python SDK.  &lt;/P&gt;

&lt;P&gt;I originally found the correct argument to use by searching for bearer in the sdk and found the Context class in &lt;A href="https://github.com/splunk/splunk-sdk-python/blob/master/splunklib/binding.py#L486"&gt;binding.py&lt;/A&gt; includes &lt;CODE&gt;self.bearerToken = kwargs.get("splunkToken", "")&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;Using git blame, it appears the code was originally comitted in October 2019 which would be after this question was asked and EricWehrly's answer, but since the situation has changed I felt an updated answer would be helpful.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 04:03:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/442892#M29202</guid>
      <dc:creator>triest</dc:creator>
      <dc:date>2020-03-26T04:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to use a token for python SDK?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/705027#M57759</link>
      <description>&lt;P&gt;Yes:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;splunk = client.connect(host='localhost', port=8089, splunkToken='eyJraWQiOiJzc.....)&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2024 11:30:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-use-a-token-for-python-SDK/m-p/705027#M57759</guid>
      <dc:creator>Kopcisko</dc:creator>
      <dc:date>2024-11-22T11:30:13Z</dc:date>
    </item>
  </channel>
</rss>

