答案 0 :(得分:1)
最简单的可能是:
https://lxml.de/api/lxml.etree-module.html#tostring
此功能采用var client = new RestClient(BaseUrl);
var request = new RestRequest(Method.POST);
request.Parameters.Clear();
request.RequestFormat = DataFormat.Json;
request.Resource = ressource;
request.AddHeader("Authorization", "Basic APITOKEN");
request.AddHeader("Content-Type", "application/json");
request.AddBody(subscription);
var response = client.Execute(request);
规范化相关的method='c14n'
,exclusive
和with-comments
。
这并不完美,但是可以让您的90%达到目标...您仍然需要手动检查内容。
接下来,较少的pythonic将是libxml2 ...,尽管以我的有限经验,它甚至更加棘手。