Reputation: 10636
I am trying to retrieve job id from splunk using python.
when I do this in curl, it works. It prints out the sid number.
curl -u <username>:<password> -k https://example.com:8089/services/search/jobs -d search="search interface*"
I get:
<response>
<sid>1899999967</sid>
</response>
I need to convert this curl code to python request, I tried this:
res=requests.get('https://example.com:8089/services/search/jobs', params= ('-d search='search interface*'"), auth=(<username>:<password>), verify=False)
I get a huge list of search results that incude other saved search results. I only need saved search interface*
Any ideas what I am doing here wrong?
Upvotes: 0
Views: 126
Reputation: 49
Well this a 3 Part process.
First Part is run the query. (Which you did.)
Secound, check if the search ran. (Succesfully) curl -u 'admin' https://localhost:8089/services/search/jobs/1289517421.3076
Thrid retrieve the results, in xml or csv.
curl -u 'admin' https://localhost:8089/services/search/jobs/1289517421.3076/results -d"output_mode=csv"
Upvotes: 0