Zapier出错是因为我没有定义输出。以下是他们在常见问题解答中提供的示例
return {'name': input_data['name']}
在我从Postman复制的Python中,JSON负载看起来不一样,所以我没有相同的地方来定义输出。这是我的代码
import requests
import json
url = "https://stackoverflowpost.com"
payload = json.dumps({
"LeadInfo": "Lead Info",
"CustomerFID": None,
"RegCommunityFID": "None",
"NameLast": "input_data['lastName']",
"NameMiddle": "None",
"NameFirst": "input_data['firstName']",
"Title": "Mr",
"NameLast2": "TEST",
"NameMiddle2": "Zap",
"NameFirst2": "Zap",
"Title2": "",
"Suffix2": "",
"StreetAddress": "Zap St",
"City": "Townsville",
"ZipCode": "12345",
"StateCode": "DE",
"PhoneHome": "input_data['phone']",
"EmailHome": "input_data['email']",
"Rating": "Rating",
"LeadSource": "LeadSource",
"RegistrationNotes": "string",
"ExternalID": "EXID",
"Status": "Status",
"ProspectNumber": "2",
"WCCustBuyerInfo": {
"ContractName": "ThisContract",
"WCBuyers": [
{}
]
}
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
我可以在哪里定义输出,以便它只输出JSON主体,而不会在代码中触发不同的错误?
每当我在代码中添加'return'时,我都会得到一个新的错误。
1条答案
按热度按时间jogvjijk1#
你必须设置一个名为output的变量,其中包含一个数组。
例如: