API Updates for AviationAssistantLink
This commit is contained in:
@@ -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':
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user