I'm trying to request against Splunk REST Api. It works greate when calling the Api with curl :
curl -k https://host:8090/services/collector/event -H "Authorization: Splunk AUTH_CODE" -d '{"event":"Hello, World!","source":"Airwatch","index":"client-myclient"}'
{"text":"Success","code":0}%
But when I try to pull the same request in python, I get a 404 error :
splunkhost = 'MY_IP'
splunkUrl = 'https://%s:8090/services/collector/event' % splunkhost
splunkData = {'index':'client-myclient','event':'Event Python Test'}
splunkResponse = requests.get(splunkUrl, headers={'Authorization': 'Splunk AUTH_CODE'}, data = splunkData, verify=False)
print splunkResponse.text
/Library/Python/2.7/site-packages/requests/packages/urllib3/connectionpool.py:789: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)
{"text":"The requested URL was not found on this server.","code":404}
I understand the insecure warning comes from my verify=false. The headers seem to pass through (splunkResponse.erquest.headers displays them correctly), and my different test haven't given anything...
What am I missing ?