I have created a python script to post json data to Splunk:
splunk_ep = 'https://xxx:8088/services/collector/event'
SPLUNK_TOKEN = os.getenv('SPLUNK_TOKEN')
auth_header = {'Authorization': SPLUNK_TOKEN, 'Content-Type': 'application/json'}
def SendToSplunk(data):
response = requests.post(splunk_ep, json=data, headers=auth_header, verify = False)
print(response)
It returns following error:
401 Client Error: Unauthorized for url: https://xxx:8088/services/collector/event
However, If use cURL with above params, it works fine. Please advise.
Thanks
↧