Quantcast
Channel: Questions in topic: "splunk-enterprise"
Viewing all articles
Browse latest Browse all 47296

Splunk HEC: Python post requests fails with 401 Unauthorized client error while cURL requests are fine

$
0
0
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

Viewing all articles
Browse latest Browse all 47296

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>