<?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: Getting &amp;quot;socket.error: [Errno 54] Connection reset by peer&amp;quot; when trying to connect to REST API using Python lib in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Getting-quot-socket-error-Errno-54-Connection-reset-by-peer-quot/m-p/215779#M2852</link>
    <description>&lt;P&gt;Answering my own question... I was using the wrong scheme.  Switched to "https" and it's now working.  This is despite the fact that the "Enable SSL (HTTPS) in Splunk Web?" option is set to "No".&lt;/P&gt;</description>
    <pubDate>Fri, 30 Oct 2015 16:35:36 GMT</pubDate>
    <dc:creator>DVGeoffrey</dc:creator>
    <dc:date>2015-10-30T16:35:36Z</dc:date>
    <item>
      <title>Getting "socket.error: [Errno 54] Connection reset by peer" when trying to connect to REST API using Python lib</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-quot-socket-error-Errno-54-Connection-reset-by-peer-quot/m-p/215778#M2851</link>
      <description>&lt;P&gt;I'm trying to connect to the Splunk REST API and am running into errors.  Not sure what to do from here...&lt;BR /&gt;
Code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client

service = client.connect(
    host="192.168.50.251",
    scheme="http",
    username="username",
    password="password"
)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am able to log into the Splunk web interface using these credentials, but when trying with the python API I get:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Traceback (most recent call last):
  File "splunk_testing.py", line 9, in &amp;lt;module&amp;gt;
    password="dev"
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/splunklib/client.py", line 321, in connect
    s.login()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/splunklib/binding.py", line 847, in login
    cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/splunklib/binding.py", line 1185, in post
    return self.request(url, message)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/splunklib/binding.py", line 1202, in request
    response = self.handler(url, message, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/splunklib/binding.py", line 1339, in request
    response = connection.getresponse()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1132, in getresponse
    response.begin()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 409, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
socket.error: [Errno 54] Connection reset by peer
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We're running Splunk 6.3.0 and I'm using splunk-sdk (Py lib) v1.5.0.  The management port is set to 8089, so I think this should work.  Am I doing something wrong?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 16:29:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-quot-socket-error-Errno-54-Connection-reset-by-peer-quot/m-p/215778#M2851</guid>
      <dc:creator>DVGeoffrey</dc:creator>
      <dc:date>2015-10-30T16:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "socket.error: [Errno 54] Connection reset by peer" when trying to connect to REST API using Python lib</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-quot-socket-error-Errno-54-Connection-reset-by-peer-quot/m-p/215779#M2852</link>
      <description>&lt;P&gt;Answering my own question... I was using the wrong scheme.  Switched to "https" and it's now working.  This is despite the fact that the "Enable SSL (HTTPS) in Splunk Web?" option is set to "No".&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 16:35:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-quot-socket-error-Errno-54-Connection-reset-by-peer-quot/m-p/215779#M2852</guid>
      <dc:creator>DVGeoffrey</dc:creator>
      <dc:date>2015-10-30T16:35:36Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "socket.error: [Errno 54] Connection reset by peer" when trying to connect to REST API using Pytho</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-quot-socket-error-Errno-54-Connection-reset-by-peer-quot/m-p/752344#M12043</link>
      <description>&lt;P&gt;the api is always on port 8089 which is https.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Aug 2025 02:36:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-quot-socket-error-Errno-54-Connection-reset-by-peer-quot/m-p/752344#M12043</guid>
      <dc:creator>johnmvang</dc:creator>
      <dc:date>2025-08-28T02:36:38Z</dc:date>
    </item>
  </channel>
</rss>

