【发布时间】:2016-06-17 20:29:45
【问题描述】:
我正在使用“请求”库来运行 SOAP 服务。
headers = {'content-type': 'application/json'}
response = requests.post(test_url,data=testData.request_body,headers=headers)
响应如下(未格式化)
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://xxx.abc.in"><SOAP-ENV:Body><ns1:LoginResponse><return><SessionID>abc12345</SessionID><ResponseCode>0</ResponseCode><ResponseMessage>Successful</ResponseMessage></return></ns1:LoginResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
我如何漂亮地打印这个?
【问题讨论】:
标签: xml web-services soap python-requests pretty-print