39 lines
988 B
Python
39 lines
988 B
Python
|
from flask import Flask, request
|
||
|
import os
|
||
|
from colormap import rgb2hex
|
||
|
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
|
||
|
@app.route('/')
|
||
|
def index():
|
||
|
os.system('gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n cc2433')
|
||
|
return 'Index Page'
|
||
|
|
||
|
@app.route('/hello')
|
||
|
def hello():
|
||
|
#a = rgb2hex(255, 255, 255)
|
||
|
|
||
|
#str = '56' + a + '00f0aa'
|
||
|
#os.system('gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n ${str}')
|
||
|
return request.query_string
|
||
|
|
||
|
#adding variables
|
||
|
@app.route('/user/<username>')
|
||
|
def show_user(username):
|
||
|
#returns the username
|
||
|
return 'Username: %s' % username
|
||
|
|
||
|
@app.route('/post/<int:post_id>')
|
||
|
def show_post(post_id):
|
||
|
#returns the post, the post_id should be an int
|
||
|
return str(post_id)
|
||
|
|
||
|
@app.route('/user', methods=['GET','POST'])
|
||
|
def get_user():
|
||
|
username = request.form['username']
|
||
|
password = request.form['password']
|
||
|
#login(arg,arg) is a function that tries to log in and returns true or false
|
||
|
status = login(username, password)
|
||
|
return status
|