<?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 Why am I getting this error trying to create a connection with my environment using the Python SDK? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-getting-this-error-trying-to-create-a-connection-with/m-p/252006#M48476</link>
    <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I'm using the sample script to connect with my environment using the Splunk Python SDK. For the development environment this works, but for the production environment, it doesn't work. Both endpoints of Splunk use https for connection.&lt;/P&gt;

&lt;P&gt;Following the code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client

HOST = "myEndPoint"
PORT = 8089
USERNAME = "admin"
PASSWORD = "changeme"

# Create a Service instance and log in 
service = client.connect(
    host=HOST,
    port=PORT,
    username=USERNAME,
    password=PASSWORD)

# Print installed apps to the console to verify login
for app in service.apps:
    print app.name 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Traceback:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Traceback (most recent call last):
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunk_Connet.py", line 13, in 
    password=PASSWORD)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\client.py", line 321, in connect
    s.login()
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 857, in login
    cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1201, in post
    return self.request(url, message)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1218, in request
    response = self.handler(url, message, **kwargs)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1357, in request
    connection.request(method, path, body, head)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 897, in _send_output
    self.send(msg)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 859, in send
    self.connect()
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1270, in connect
    HTTPConnection.connect(self)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 836, in connect
    self.timeout, self.source_address)
  File "C:\Python27\lib\socket.py", line 575, in create_connection
    raise err
socket.error: [Finished in 21.6s]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 11 Jul 2016 18:52:53 GMT</pubDate>
    <dc:creator>rafamss</dc:creator>
    <dc:date>2016-07-11T18:52:53Z</dc:date>
    <item>
      <title>Why am I getting this error trying to create a connection with my environment using the Python SDK?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-getting-this-error-trying-to-create-a-connection-with/m-p/252006#M48476</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;I'm using the sample script to connect with my environment using the Splunk Python SDK. For the development environment this works, but for the production environment, it doesn't work. Both endpoints of Splunk use https for connection.&lt;/P&gt;

&lt;P&gt;Following the code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunklib.client as client

HOST = "myEndPoint"
PORT = 8089
USERNAME = "admin"
PASSWORD = "changeme"

# Create a Service instance and log in 
service = client.connect(
    host=HOST,
    port=PORT,
    username=USERNAME,
    password=PASSWORD)

# Print installed apps to the console to verify login
for app in service.apps:
    print app.name 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Traceback:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Traceback (most recent call last):
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunk_Connet.py", line 13, in 
    password=PASSWORD)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\client.py", line 321, in connect
    s.login()
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 857, in login
    cookie="1") # In Splunk 6.2+, passing "cookie=1" will return the "set-cookie" header
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1201, in post
    return self.request(url, message)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1218, in request
    response = self.handler(url, message, **kwargs)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\splunklib\binding.py", line 1357, in request
    connection.request(method, path, body, head)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1057, in request
    self._send_request(method, url, body, headers)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1097, in _send_request
    self.endheaders(body)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 897, in _send_output
    self.send(msg)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 859, in send
    self.connect()
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 1270, in connect
    HTTPConnection.connect(self)
  File "C:\Users\rmshzol\PycharmProjects\splunk-sdk\httplib.py", line 836, in connect
    self.timeout, self.source_address)
  File "C:\Python27\lib\socket.py", line 575, in create_connection
    raise err
socket.error: [Finished in 21.6s]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jul 2016 18:52:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-getting-this-error-trying-to-create-a-connection-with/m-p/252006#M48476</guid>
      <dc:creator>rafamss</dc:creator>
      <dc:date>2016-07-11T18:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I getting this error trying to create a connection with my environment using the Python SDK?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-getting-this-error-trying-to-create-a-connection-with/m-p/252007#M48477</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;

&lt;P&gt;This error stoped of occur magically &lt;STRONG&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/STRONG&gt;. I believe that I was blocked for any rule in my network.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 13:03:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Why-am-I-getting-this-error-trying-to-create-a-connection-with/m-p/252007#M48477</guid>
      <dc:creator>rafamss</dc:creator>
      <dc:date>2016-07-12T13:03:32Z</dc:date>
    </item>
  </channel>
</rss>

