API Updates for AviationAssistantLink

This commit is contained in:
LAX18 Development
2022-02-25 21:38:52 -05:00
parent 70baff298d
commit 13ddd5be61
2 changed files with 42 additions and 0 deletions
+20
View File
@@ -2,6 +2,8 @@ from flask import Flask, json, request
import os
app = Flask(__name__)
name = "Aviation Assistant"
version = "v.2.7.2-aaf68f9bf2b51806300f7830f67f5254f04a90a2"
@app.route('/brightness',methods = ['POST'])
def brightness():
@@ -13,11 +15,29 @@ def brightness():
status = os.popen('sudo cat /sys/class/backlight/rpi_backlight/brightness').read()
return status
@app.route('/information',methods = ['GET'])
def information():
ip = os.popen("ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'").read()
json = {
"name": name,
"version": version,
"ip": ip
}
return json
@app.route('/connection',methods = ['GET'])
def connection():
if request.method == 'GET':
return "OK"
@app.route('/authentication',methods = ['POST'])
def authentication():
json = request.get_json()
if json['username'] == "npease" and json['password'] == "1118":
return "OK"
else:
return "NO"
@app.route('/audio',methods = ['POST'])
def volume():
if request.method == 'POST':
+22
View File
@@ -13,6 +13,28 @@ def brightness():
status = os.popen('sudo cat /sys/class/backlight/rpi_backlight/brightness').read()
return status
@app.route('/connection',methods = ['GET'])
def connection():
if request.method == 'GET':
return "OK"
@app.route('/authentication',methods = ['POST'])
def authentication():
json = request.get_json()
if json['username'] == "npease" and json['password'] == "1118":
return "OK"
else:
return "NO"
@app.route('/information',methods = ['GET'])
def information():
ip = os.popen("ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'").read()
json = {
"name": name,
"version": version,
"ip": ip
}
return json
@app.route('/audio',methods = ['POST'])
def volume():