Python code example:
# pip install Flask
"""# webhook URL
# 120.10.11.11 public IP address
http://120.10.11.11:9999/lock/lockevent
http://120.10.11.11:9999/lock/Positiondata
http://120.10.11.11:9999/lock/alarm
http://120.10.11.11:9999/lock/cmdresponse
"""
from flask import Flask, request
app = Flask(__name__)
@app.route('/lock/lockevent', methods=['POST'])
def lock_lockevent():
if request.method == 'POST':
print("Data received from Webhook is: ", request.json)
return "Webhook received! lockevent"
@app.route('/lock/Positiondata', methods=['POST'])
def lock_Positiondata():
if request.method == 'POST':
print("Data received from Webhook is: ", request.json)
return "Webhook received! Positiondata"
@app.route('/lock/alarm', methods=['POST'])
def lock_alarm():
if request.method == 'POST':
print("Data received from Webhook is: ", request.json)
return "Webhook received! alarm"
@app.route('/lock/cmdresponse', methods=['POST'])
def lock_cmdresponse():
if request.method == 'POST':
print("Data received from Webhook is: ", request.json)
return "Webhook received! cmdresponse"
app.run(host='0.0.0.0', port=9999)
文档更新时间: 2023-05-15 16:54 作者:Jeson