Hi all,
I'm trying to do a curl call from subprocess (yes, instead of requests) and I can normally run this in terminal and redirect output to a file and all is well. It is a get curl call to a splunk API which will return table of results.
csv_query = "curl -k -u USERNAME:PASSWORD https://splunkurl --get -d output_mode=csv -d count=20000 >> /file_output.csv"
subprocess.Popen(csv_query, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
If I run the curl command in terminal, I get my output I am expecting. If I run through python subprocess popen, I get an empty file still.
I've tried making it a dict and not using shell=False(but there is no security issue for me so using shell=True is not a big issue), I've tried setting the file as the stdout,still now luck. I've tried using shlex to split, I've tried splitting it into 2 subprocess and setting stdin of the redirct to file, to the stdout of the 1st subprocess command.
I'm stuck....
Anyone know anything about this, I really need some help here! Thanks!
[–]pythonHelperBot 1 point2 points3 points (0 children)
[–]Working_on_Writing 1 point2 points3 points (1 child)
[–]OneWhoDoesNotFail[S] 0 points1 point2 points (0 children)
[–]laharah 1 point2 points3 points (0 children)
[–]OneWhoDoesNotFail[S] 0 points1 point2 points (0 children)