当收到带有 XML 正文的 HTTP 响应时,GCP Cloud Functions 失败并显示 'connection error' 或 'crash'

GCP Cloud Functions fails with 'connection error' or 'crash' when received HTTP response with XML body

我正在尝试使用 Python SDK 从 Docusign Connect 向 GCP 云功能发送带有 XML 正文的 HTTP POST 响应。

当响应到来时,云函数每次都会给出以下错误。
函数执行耗时 59 毫秒,完成状态:'connection error'函数执行耗时 59 毫秒,完成状态:'crash'

该功能甚至没有开始工作。请帮我解决这个问题。

此外,我不确定如何解析从外部源收到的 XML 响应。我在文档中没有找到任何内容。

我已经自行解决了上述问题。问题在于解析 XML 请求。我使用 xmltodict 方法解析它。

请找到解析 XML 正文的示例代码。

import logging
import xmltodict

def main (request):
    data = xmltodict.parse(request.data)
    logging.info(data)