【问题标题】:ZAPIER- Output Missing or Return Early Error in PythonZAPIER-Python 中的输出丢失或返回早期错误
【发布时间】:2020-11-06 20:48:24
【问题描述】:

我收到绿色警报,但我的 POST 无法正常工作,并且出现错误:output_missing 请定义输出或提前返回。

我正在尝试使用 Python 发送 SOAP 请求:


url = "https://service.velocify.com/ClientService.asmx"

headers = {
    'Content-Type': 'text/xml; charset=utf-8',
    'Host': 'service.velocify.com',
    'Content-Length': '0',
    'SOAPAction': 'https://service.leads360.com/ModifyLeadField'
}

body = """
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ModifyLeadField xmlns="https://service.leads360.com">
<username>*************</username>
<password>***********</password>
<leadId>310595</leadId>
<fieldId>1238</fieldId>
<newValue>blah</newValue>
</ModifyLeadField>
</soap:Body>
</soap:Envelope>

"""

r = requests.post(url, headers=headers, params=body)
print(r.content)

【问题讨论】:

    标签: python xml soap zapier


    【解决方案1】:

    Zapier 要求您在代码中使用 output 语句,然后可以在下一个 Zaps 中使用。您可以在代码的最后添加类似这样的内容:

    output = {'response':r.content}
    

    然后key+value会在下一个Zap中可用。

    【讨论】:

    • 谢谢,我添加了这个,然后我知道可能会出现另一个错误,即“不是 JSON 可序列化”。我也尝试过通过 javascript 发送这个 SOAP 请求,但两者似乎都是不可能的,因为我发现的很多代码都需要 Zap 不接受的库或模块。您知道我可以成功发送此 SOAP 请求的最佳方式吗?
    • 感谢您的更新。我重新检查了有关 output 语句的文档,它指出 output 必须是 JSON 可序列化的。 zapier.com/help/create/code-webhooks/… 这可能是您当前遇到的错误。在这种情况下,您能否检查一下这是否可行:output = {'response':r.text}
    猜你喜欢
    • 2021-08-06
    • 1970-01-01
    • 1970-01-01
    • 2018-12-26
    • 2021-03-19
    • 2015-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多