Skip to content
Snippets Groups Projects
Commit c5b5ef6c authored by 成恩 伍's avatar 成恩 伍
Browse files

Upload New File

parent e274ba7b
No related branches found
No related tags found
No related merge requests found
from flask import Flask
import requests
import json
app = Flask(__name__)
@app.route("/doorStatus", methods=["GET"])
def getDoorStatus():
res = requests.get(url="http://114.116.217.108:59882/api/v2/device/name/door/doorStatus")
status = json.loads(res.text)['event']['readings'][0]['value']
message = ''
if status == '0':
message = "识别异常不可进入"
else:
message = "识别正常可以进入"
Data = '[{status:"' + str(status) + '","text":"' + str(message) + '}]'
return Data
app.run(host="0.0.0.0", port=3000)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment