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

时间:2015-02-26 20:49:52

标签: python curl lxml

以下命令通过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.tostring(树)。

0 个答案:

没有答案