将 .py 转换为节点红色流

问题描述

有谁知道我如何将带有表单数据的 Python http 请求转换为节点红色流?

import requests

url = "http://127.0.0.1:5000/read"
read_req = {"address": "12345:2","object_type": "analogValue","object_instance": "302"}

print(requests.post(url,read_req).text)

在 node-red 中有一个 http 请求块:

enter image description here

但是在节点红色中,似乎没有用于表单数据的 http 帖子的简单按钮。有人会有任何提示吗?如果我需要达到那个程度,任何有关 javascript 函数的提示将不胜感激。

enter image description here

我是否会将这样的 msg.payload javascript 函数合并到 http 请求节点中?

enter image description here

更新的 javascript 函数:

msg.headers = {
    "Content-Type": "application/json"
};
msg.payload = {
    "address": "12345:2","object_instance": "302"
};
return msg;

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)