在curl命令中将lxml变量作为xml在python中传递

2024-06-01 01:59:35 发布

您现在位置:Python中文网/ 问答频道 /正文

以下命令正在通过Unix终端工作:

 curl  -v -k  --data-binary @./SampleRequest_OFFSHORE.xml https://world-service-dev.intra.aexp.com:4414/worldservice/CLIC/CaseManagementService/V1

但是当我通过python传递相同的命令时,我得到了一个错误,因为我不能在这里正确地传递请求变量。我的python代码:

from lxml import etree

tree = etree.parse(template_xml)

//Modified tree variable in my code and making the following call 
response = subprocess.check_output(["curl", "-k",'-v', '--data-binary' , etree.tostring(tree), "https://world-service-dev.intra.aexp.com:4414/worldservice/CLIC/CaseManagementService/V1"])

你能帮我通过考试吗etree.to字符串(树)正确地在代码中。你知道吗


Tags: httpsdev命令comtreeworlddataservice