0

I have the following command executed in the linux shell:

$ curl -s -K <\(echo user = "$AUTH") "${URI%/}"

where AUTH and URI are environment variables. I have tried to execute the command with 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 I always receive an error of this kind

"sh: 1: cannot open (echo: No such file"

or

"sh: 1: Syntax error: "(" unexpected".

It seem to me there is a problem with the escaping of the special symbols. Can you help me with this one?

kylieCatt
  • 10,672
  • 5
  • 43
  • 51
cBeTyLkaTa
  • 3
  • 1
  • 3

1 Answers1

0

run your command in:

cmd = "curl -s -K<conf_file> -u 'username:password' 'www.something.com'"

os.system(cmd)
rickydj
  • 629
  • 5
  • 17