linux - Execute curl with parameters- Python 2.6.6 -
i have following command executed in linux shell:
$ curl -s -k <\(echo user = "$auth") "${uri%/}" where auth , uri environment variables. have tried execute command python program in several ways:
1.
import os b = os.popen('curl -s -k <(echo user = $auth) $uri').readlines() 2.
import subprocess subprocess.call( ['curl -s -k <(echo user = $auth) $uri'], shell=true,stderr=subprocess.stdout ) but receive error of kind
"sh: 1: cannot open (echo: no such file" or
"sh: 1: syntax error: "(" unexpected". it seem me there problem escaping of special symbols. can me one?
run command in:
cmd = "curl -s -k<conf_file> -u 'username:password' 'www.something.com'" os.system(cmd)
Comments
Post a Comment