I am trying to upload CSV file to a certain index and a certain sourcetype (already exist in Splunk) with a python script. I have already installed Python SDK Splunk and I am using Python 3 with anaconda
import splunklib.client as client
service = client.connect(host='localhost',port=8089,username='admin',password='Passwd')
myindex = service.indexes["Index1"]
mysocket = myindex.attach(sourcetype='ST1',host='My_PC')
file_data = ''
with open("ST1_23_Mai_2018.csv", "r") as lines:
for line in lines:
line = ' '
file_data += line
file_data += '\r\n'
The SSL handshake is successful. However, I am getting following error through python:-
File "C:\Users\XXX\AppData\Local\Continuum\anaconda3\lib\ssl.py", line 642, in write
TypeError: a bytes-like object is required, not 'str'