-1

I have values in two variables

SessionId=Pxsvdsdruhn 
ServerUrl=https://app3.xxxxxxxxcloud.com/saas

I want to pass these values in curl command and execute it from python script. I tried below but its giving syntax error

os.system("curl -X GET -H "Content-Type:application/json" -H "Accept: application/json" -H "icSessionId":"SessionId" ServerUrl/api/v2/agent")

Any pointers where i am wrong?

Prashast
  • 57
  • 8

1 Answers1

-1

The way to do what you are looking for is a technique called string interpolation. Fortunately, this has already been answered on StackOverflow.

Is there a Python equivalent to Ruby's string interpolation?

I'd also strongly recommend using single quotes around your command so that way you can escape the double quotes in your string. The python interpreter thinks you're putting separate strings together, instead of treating the quotes as an "embedded" string.

ddeamaral
  • 1,403
  • 2
  • 28
  • 43