<?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 Getting errors when running a.py in Splunk Python SDK. in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Getting-errors-when-running-a-py-in-Splunk-Python-SDK/m-p/459359#M8363</link>
    <description>&lt;P&gt;We use Splunk cloud and I'm trying to figure out how to use the Splunk Python SDK but I'm stuck on the first example. When I first ran a.py, I got the error:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NameError: name 'six' is not defined
Which I fixed by adding "as six" to "import splunklib.six.moves.http_client"&lt;/LI-CODE&gt;
&lt;P&gt;Now I'm stuck, getting the following when I enter python a.py:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
File "a.py", line 30, in 
connection = six.moves.http_client.HTTPSConnection(HOST, PORT)
AttributeError: 'module' object has no attribute 'moves&lt;/LI-CODE&gt;
&lt;P&gt;Any thoughts?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jun 2020 21:15:33 GMT</pubDate>
    <dc:creator>jrfreeze</dc:creator>
    <dc:date>2020-06-18T21:15:33Z</dc:date>
    <item>
      <title>Getting errors when running a.py in Splunk Python SDK.</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-errors-when-running-a-py-in-Splunk-Python-SDK/m-p/459359#M8363</link>
      <description>&lt;P&gt;We use Splunk cloud and I'm trying to figure out how to use the Splunk Python SDK but I'm stuck on the first example. When I first ran a.py, I got the error:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;NameError: name 'six' is not defined
Which I fixed by adding "as six" to "import splunklib.six.moves.http_client"&lt;/LI-CODE&gt;
&lt;P&gt;Now I'm stuck, getting the following when I enter python a.py:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
File "a.py", line 30, in 
connection = six.moves.http_client.HTTPSConnection(HOST, PORT)
AttributeError: 'module' object has no attribute 'moves&lt;/LI-CODE&gt;
&lt;P&gt;Any thoughts?&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2020 21:15:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-errors-when-running-a-py-in-Splunk-Python-SDK/m-p/459359#M8363</guid>
      <dc:creator>jrfreeze</dc:creator>
      <dc:date>2020-06-18T21:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a.py in Splunk Python SDK to run?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-errors-when-running-a-py-in-Splunk-Python-SDK/m-p/459360#M8364</link>
      <description>&lt;P&gt;OK, this turned out to be a silly oversight. I had changed the "import" line, but then hadn't changed the actual connection definition is line 30 from:&lt;BR /&gt;
&lt;CODE&gt;connection = six.moves.http_client.HTTPSConnection(HOST, PORT)&lt;/CODE&gt;&lt;BR /&gt;
to&lt;BR /&gt;
&lt;CODE&gt;connection = six.HTTPSConnection(HOST, PORT)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Now that error is solved but I still can't seem to get connected via Python. I'm thinking I need to have greater permissions maybe? Here's the new traceback:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Traceback (most recent call last):
  File "a.py", line 43, in 
    connection.request("POST", "/services/auth/login", body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1053, in request
    self._send_request(method, url, body, headers)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1093, in _send_request
    self.endheaders(body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1049, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 893, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 855, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1274, in connect
    server_hostname=server_hostname)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 352, in wrap_socket
    _context=self)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 579, in __init__
    self.do_handshake()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 808, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 May 2019 18:47:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-errors-when-running-a-py-in-Splunk-Python-SDK/m-p/459360#M8364</guid>
      <dc:creator>jrfreeze</dc:creator>
      <dc:date>2019-05-20T18:47:01Z</dc:date>
    </item>
  </channel>
</rss>

