安装docker
安装完成后,运行以下代码,自动拉取node-red最新镜像
docker run -it -p 1880:1880 -p 3001:3001 -v $PWD/node-red-data:/data --name mynodered nodered/node-red
Docker容器中的数据同步到主机: 根目录/root/node-red-data
已备份到阿里云OSS
开放1880/3001
端口
用户名为全拼
密码为*******nodered
其余内容参考以下网页:
iobroker
csdn
nodered
推送企业微信示例:
[
{
"id": "961e7f75.b79e8",
"type": "debug",
"z": "a821a3cd.dc519",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 380,
"wires": []
},
{
"id": "b55de71b.af68e8",
"type": "bizwechat-input",
"z": "a821a3cd.dc519",
"name": "",
"bizwechat": "7fb68595.dc20dc",
"x": 550,
"y": 380,
"wires": [
[
"961e7f75.b79e8",
"3a90271d.7a4418"
]
]
},
{
"id": "197f046.a75b4fc",
"type": "bizwechat-output",
"z": "a821a3cd.dc519",
"name": "",
"bizwechat": "7fb68595.dc20dc",
"x": 950,
"y": 260,
"wires": []
},
{
"id": "3a90271d.7a4418",
"type": "function",
"z": "a821a3cd.dc519",
"name": "",
"func": "\nmsg.payload = \"\"\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 710,
"y": 260,
"wires": [
[
"197f046.a75b4fc"
]
]
},
{
"id": "6b5e68a1.47e678",
"type": "bizwechat-pushbear",
"z": "a821a3cd.dc519",
"name": "",
"bizwechat": "7fb68595.dc20dc",
"touser": "",
"toparty": "测试",
"title": "",
"description": "",
"x": 710,
"y": 500,
"wires": [
[
"961e7f75.b79e8",
"55582f81.65582"
]
]
},
{
"id": "6eab327f.5bff3c",
"type": "inject",
"z": "a821a3cd.dc519",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 370,
"y": 580,
"wires": [
[
"c91a36fe.015888"
]
]
},
{
"id": "77a246e5.369b68",
"type": "function",
"z": "a821a3cd.dc519",
"name": "",
"func": "msg.payload = msg.req.body.payload;\nmsg.title = msg.req.body.title;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 550,
"y": 500,
"wires": [
[
"6b5e68a1.47e678"
]
]
},
{
"id": "e2a77bf7.796068",
"type": "http in",
"z": "a821a3cd.dc519",
"name": "",
"url": "post",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 360,
"y": 500,
"wires": [
[
"77a246e5.369b68"
]
]
},
{
"id": "55582f81.65582",
"type": "http response",
"z": "a821a3cd.dc519",
"name": "",
"statusCode": "",
"headers": {},
"x": 950,
"y": 500,
"wires": []
},
{
"id": "c91a36fe.015888",
"type": "function",
"z": "a821a3cd.dc519",
"name": "",
"func": "\nmsg.payload = `我们为记录思想和分享知识提供更专业的工具。 您可以使用 Cmd Markdown:\n\n> * 整理知识,学习笔记\n> * 发布日记,杂文,所见所想\n> * 撰写发布技术文稿(代码支持)\n> * 撰写发布学术论文(LaTeX 公式支持)\n\n![cmd-markdown-logo](https://www.zybuluo.com/static/img/logo.png)`\nmsg.title = '测试'\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"x": 550,
"y": 580,
"wires": [
[
"6b5e68a1.47e678"
]
]
},
{
"id": "7fb68595.dc20dc",
"type": "bizwechat-configurator",
"z": "",
"name": "",
"port": "3001",
"corpid": "wxc9daffb2cdab64b1",
"agentid": " ",
"corpsecret": " ",
"url": "",
"token": " ",
"aeskey": " ",
"client_id": "",
"client_secret": ""
}
]
推送方式为post:
Python推送格式:
import json
import requests
headers = {'Content-Type': 'application/json'}
datas = json.dumps({"payload":"从Python发送过来的推送消息", "title":"这是标题"})
r = requests.post("http://IP:1880/post", data=datas, headers=headers)
print(r.text)
消息样式:
至此,配合python爬虫,能干的事情的就很多了。