I can run a splunk api call in bash and get back a SID which I then use to get back a splunk query. The first part of it is below. However, I am having issues when changing this to a python request using requests. I keep getting an ssl CERTIFICATE_VERIFY_FAILED error.
Bash Command
data=$( curl -k -u username:password https://<splunk_endpoint>/services/search/jobs -d 'search=search earliest=-1m index=_internal')
echo $data
Bash Output: 1538748227.228319_D07875A9-FDD6-46E8-BE77-EDF9BD9A73B1
python requests
import requests
baseurl = 'https://<splunk_endpoint>/services/search/jobs'
headers = {
"Content-Type": "application/json",
}
data = {
'username': 'username',
'password': 'password',
"search": "search earliest=-1m index=_internal",
}
r = requests.get(baseurl, data=json.dumps(data), headers=headers)
print(r.json())
I'm not exactly sure where to put the username and password. Does that belong in 'data'? in headers? somewhere else? I also don't know if my -d conversino to the data dictionary is correct. I think it is.
Any thoughts