<?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: Why am I unable to connect to Splunk via SDK client.connect function? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319534#M4415</link>
    <description>&lt;P&gt;Ah, yes, makes sense. thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 11 Apr 2018 11:28:31 GMT</pubDate>
    <dc:creator>fetterman</dc:creator>
    <dc:date>2018-04-11T11:28:31Z</dc:date>
    <item>
      <title>Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319531#M4412</link>
      <description>&lt;P&gt;I am following the Splunk SDK example using version 1.6.3 with Python 3, on Splunk 6.6.4:&lt;/P&gt;

&lt;P&gt;import splunklib.client as client&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;HOST = "localhost"
PORT = 8000
USERNAME = "admin"
PASSWORD = "changeme"

service = client.connect(
    host=HOST,
    port=PORT,
    username=USERNAME,
    password=PASSWORD)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for app in service.apps:&lt;/P&gt;

&lt;P&gt;print app.name&lt;BR /&gt;
I have changed the hard-coded credentials to match valid login info, however I am receiving the following response:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Traceback (most recent call last):

  File "/opt/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "", line 6, in 
    password=PASSWORD

  File "/opt/anaconda3/lib/python3.6/site-packages/splunk_sdk-1.6.3-py3.6.egg/splunklib/client.py", line 322, in connect
    s.login()

  File "/opt/anaconda3/lib/python3.6/site-packages/splunk_sdk-1.6.3-py3.6.egg/splunklib/binding.py", line 862, in login
    session = XML(body).findtext("./sessionKey")

  File "/opt/anaconda3/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML
    parser.feed(text)

  File "", line unknown
ParseError: syntax error: line 1, column 0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Apr 2018 18:39:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319531#M4412</guid>
      <dc:creator>fetterman</dc:creator>
      <dc:date>2018-04-10T18:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319532#M4413</link>
      <description>&lt;P&gt;Check indentation in code. Also , port should be 8089 or (your splunk management port) not 8000.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 04:45:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319532#M4413</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-04-11T04:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319533#M4414</link>
      <description>&lt;P&gt;Yes port is his issue&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 07:31:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319533#M4414</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2018-04-11T07:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319534#M4415</link>
      <description>&lt;P&gt;Ah, yes, makes sense. thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 11:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319534#M4415</guid>
      <dc:creator>fetterman</dc:creator>
      <dc:date>2018-04-11T11:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319535#M4416</link>
      <description>&lt;P&gt;I have the same issue. But, I used port 8089. But, I am still not able to connect. The error I get is:&lt;/P&gt;

&lt;P&gt;ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)&lt;/P&gt;

&lt;P&gt;The code is below for the connection I use. Please guide me here.&lt;/P&gt;

&lt;P&gt;import splunklib.client as client&lt;/P&gt;

&lt;P&gt;HOST = "localhost"&lt;BR /&gt;
PORT = 8089&lt;BR /&gt;
USERNAME = "admin"&lt;BR /&gt;
PASSWORD = "Qwerty@1993"&lt;/P&gt;

&lt;P&gt;service = client.connect(&lt;BR /&gt;
    host=HOST,&lt;BR /&gt;
    port=PORT,&lt;BR /&gt;
    username=USERNAME,&lt;BR /&gt;
    password=PASSWORD)&lt;/P&gt;

&lt;P&gt;for app in service.apps:&lt;BR /&gt;
    print app.name&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:49:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319535#M4416</guid>
      <dc:creator>chandrasekharko</dc:creator>
      <dc:date>2020-09-29T20:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319536#M4417</link>
      <description>&lt;P&gt;I got it never mind.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Aug 2018 19:06:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319536#M4417</guid>
      <dc:creator>chandrasekharko</dc:creator>
      <dc:date>2018-08-09T19:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319537#M4418</link>
      <description>&lt;P&gt;How did you fix this issue?&lt;BR /&gt;
I also got same issue.&lt;BR /&gt;
I use port 8000, as it is the port I connect to using web browser.&lt;BR /&gt;
When I use port 8000, I got the same error msg as you.&lt;/P&gt;

&lt;P&gt;I also tried port 8089 or 443, both will lead to different error messages: &lt;BR /&gt;
ConnectionRefusedError, &lt;BR /&gt;
which implies the port could be wrong&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 09:41:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319537#M4418</guid>
      <dc:creator>turbocid</dc:creator>
      <dc:date>2018-08-16T09:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319538#M4419</link>
      <description>&lt;P&gt;How did you fix this issue?&lt;BR /&gt;
I also got same issue.&lt;BR /&gt;
I use port 8000, as it is the port I connect to using web browser.&lt;BR /&gt;
When I use port 8000, I got the same error msg as you.&lt;/P&gt;

&lt;P&gt;I also tried port 8089 or 443, both will lead to different error messages: &lt;BR /&gt;
ConnectionRefusedError, &lt;BR /&gt;
which implies the port could be wrong&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 09:41:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319538#M4419</guid>
      <dc:creator>turbocid</dc:creator>
      <dc:date>2018-08-16T09:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319539#M4420</link>
      <description>&lt;P&gt;I by passed the SSL cert&lt;BR /&gt;
run this command before execute the python script&lt;BR /&gt;
export PYTHONHTTPSVERIFY=0&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 17:15:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319539#M4420</guid>
      <dc:creator>chandrasekharko</dc:creator>
      <dc:date>2018-08-17T17:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to connect to Splunk via SDK client.connect function?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319540#M4421</link>
      <description>&lt;P&gt;Try running this command before execute the python script to bypass the cert&lt;BR /&gt;
export PYTHONHTTPSVERIFY=0&lt;/P&gt;</description>
      <pubDate>Fri, 17 Aug 2018 19:07:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Why-am-I-unable-to-connect-to-Splunk-via-SDK-client-connect/m-p/319540#M4421</guid>
      <dc:creator>chandrasekharko</dc:creator>
      <dc:date>2018-08-17T19:07:25Z</dc:date>
    </item>
  </channel>
</rss>

