This is a followup to this Stackoverflow post
How to use Python variables in Google Colab terminal command?
Which asks how to send python variables to the command line.
The answer is you need to place a $ in front of it. In other cases, you need to quote everything like this '$variable'
This works for me except for curl commands. For example
emailBody1 = ' this is some test text'
!curl -X POST 'http://localhost.yxy' -H "Content-Type: application/json" -d '{"emails": [{"emailBody": '$emailBody1'}}'
I tried no quotes, single quotes, and double quotes. No quotes results in an error, and single/double quotes just sends whatever is inside as a string; no reference to the variable.
requestsand later use only python for this.jq, or bash at all. Python has perfectly good network functionality. Use it.requestsinstead of shelling out tocurl.