0

如何使用 Python 编程语言访问WebhookDataAzure 自动化 webhook 中的对象。我阅读了有关此的文档,但它在 PowerShell 中,对我的实例没有帮助。我的 Azure Webhook URL 端点正在成功接收来自自定义外部应用程序的数据。我想读取接收到的数据并运行由接收到的数据驱动的逻辑。如下图所示,我正在 Azure 中接收数据。

WEBHOOKDATA 进入 Azure

这是我尝试访问WEBHOOKDATA输入参数时收到的错误消息:

Traceback (most recent call last): File "C:\Temp\rh0xijl1.ayb\3b9ba51c-73e7-44ba-af36-3c910e659c71", line 7, in <module> received_data = WEBHOOKDATA NameError: name 'WEBHOOKDATA' is not defined

这是产生错误消息的代码:

#!/usr/bin/env python3
import json

# Here is where my question is. How do I get this in Python?
# Surely, I should be able to access this easily. But how. 
# Powershell does have a concept of param in the documentation - but I want to do this in Python.
received_data = WEBHOOKDATA   
#convert JSON to string
received_as_text = json.dumps(received_data)
print(received_as_text)
4

1 回答 1

1

您可以使用 访问 Runbook 输入参数sys.argv。请参阅教程:创建 Python 3 Runbook

于 2022-01-16T23:07:09.210 回答