Я пытаюсь отправить запрос скручивания ниже, я хочу отправить многозначное значение для поля "comment":
как "comment": "line1 \n line2 \n line3"
, и оно выдает ошибку, как мне отправить многозначную строку в это поле?
from subprocess import Popen, PIPE, call
def runCmd(cmd):
print "Running command %s"%cmd
proc = Popen(cmd , shell=True, stdin=PIPE,stdout=PIPE, stderr=PIPE)
(output, error) = proc.communicate()
if output:
print "%s"%output
if error:
print '%s'%error
return output.strip(),error.strip()
curl_command = """curl -X POST \
https://team-builds-staging-6x3isq.usspk02.server.company.com/api/external/builds \
-H 'API-KEY: xxxxx' \
-H 'Accept: application/javascript' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: xxxxx' \
-H 'cache-control: no-cache' \
-d '{
"test_build": {
"team_name": "tech",
"tracking_radar_id":"1234567",
"milestone_name": "milestone",
"name": "tech Test build 4/3 - safe to delete",
"version": "1.x",
"submission_planned_at": "2019-04-04",
"comment": "line1 line2 line3",
"build_radars": "line1 line2",
"tools_id": "https://tools.company.com/ui/containers/10338212",
"build_tests": "QL, Hotspot, Stability Rack, IOT, Roaming, AWDL-Functional, AWDL-Performance, Performance",
"sdk_used": "milestone17A428d",
"dependencies": "",
"unit_tests": "",
"hw": "",
"notification": "username@company.com",
"note":"Additional notes
}
}'"""
(output,error)=runCmd(curl_command)