I'm doing my first python script connecting to Splunk. It fails with following error:
Traceback (most recent call last):
File "PrintInterntalIndexEventCount.py", line 14, in <module>
password=PASSWORD,scheme=scheme)
File "C:\Python27\lib\site-packages\splunklib\client.py", line 305, in connect
return Service(**kwargs).login()
File "C:\Python27\lib\site-packages\splunklib\binding.py", line 761, in login
password=self.password)
File "C:\Python27\lib\site-packages\splunklib\binding.py", line 1090, in post
return self.request(url, message)
File "C:\Python27\lib\site-packages\splunklib\binding.py", line 1107, in request
response = self.handler(url, message, **kwargs)
File "C:\Python27\lib\site-packages\splunklib\binding.py", line 1225, in request
connection.request(method, path, body, head)
File "C:\Python27\lib\httplib.py", line 1001, in request
self._send_request(method, url, body, headers)
File "C:\Python27\lib\httplib.py", line 1035, in _send_request
self.endheaders(body)
File "C:\Python27\lib\httplib.py", line 997, in endheaders
self._send_output(message_body)
File "C:\Python27\lib\httplib.py", line 850, in _send_output
self.send(msg)
File "C:\Python27\lib\httplib.py", line 812, in send
self.connect()
File "C:\Python27\lib\httplib.py", line 1216, in connect
server_hostname=server_hostname)
File "C:\Python27\lib\ssl.py", line 350, in wrap_socket
_context=self)
File "C:\Python27\lib\ssl.py", line 566, in __init__
self.do_handshake()
File "C:\Python27\lib\ssl.py", line 788, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
Here is the script
import splunklib.client as client
HOST = "lonsl1101443.uk.net.intra"
PORT = 8089
USERNAME = "user"
PASSWORD = "pwd"
scheme="https"
service = client.connect(
host=HOST,
port=PORT,
username=USERNAME,
password=PASSWORD,scheme=scheme)
for app in service.apps:
print app.name
If someone has the slightest idea about why this could fail, that would help!
... View more