gpt4 book ai didi

python - 使用来自 Azure IoT 中心的数据

转载 作者:行者123 更新时间:2023-12-03 05:34:05 25 4
gpt4 key购买 nike

我有设备定期向 Azure IoT 中心(不是 Azure 事件中心)发送数据。

我正在尝试用在云上运行的 Python 编写一些东西,等待这些事件/消息到达,然后将数据存储在数据库中。

Azure Python SDK 的一些类和 API 会使用来自事件中心的数据,例如 EventHubConsumerClient.receive

但是。在这种情况下,我只能使用 IoT 中心。

如何从 Azure IoT 中心使用/提取数据?我对此有点迷失。提前致谢。

最佳答案

IoT 中心在底层使用事件中心并公开一个端点:

IoT Hub exposes the messages/events built-in endpoint for your back-end services to read the device-to-cloud messages received by your hub. This endpoint is Event Hub-compatible, which enables you to use any of the mechanisms the Event Hubs service supports for reading messages.

参见the docs关于这个话题。

因此,这意味着您可以使用 Azure SDK for Python 通过事件中心类读取数据。要开始使用,请关注 this基于Python的教程。

关于python - 使用来自 Azure IoT 中心的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63811624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com