latest
This commit is contained in:
parent
c1c35bfc32
commit
b1e002ddf7
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
venv/
|
23
.vscode/launch.json
vendored
Normal file
23
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python: Flask",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "flask",
|
||||
"env": {
|
||||
"FLASK_APP": "server.py",
|
||||
"FLASK_ENV": "development"
|
||||
},
|
||||
"args": [
|
||||
"run",
|
||||
"--no-debugger"
|
||||
],
|
||||
"jinja": true
|
||||
}
|
||||
]
|
||||
}
|
Binary file not shown.
Binary file not shown.
22
requirements.txt
Normal file
22
requirements.txt
Normal file
@ -0,0 +1,22 @@
|
||||
black==21.9b0
|
||||
click==8.0.3
|
||||
colorama==0.4.4
|
||||
colorlog==6.5.0
|
||||
colormap==1.0.4
|
||||
easydev==0.12.0
|
||||
Flask==2.0.2
|
||||
importlib-metadata==4.8.1
|
||||
itsdangerous==2.0.1
|
||||
Jinja2==3.0.2
|
||||
MarkupSafe==2.0.1
|
||||
mypy-extensions==0.4.3
|
||||
pathspec==0.9.0
|
||||
pexpect==4.8.0
|
||||
platformdirs==2.4.0
|
||||
ptyprocess==0.7.0
|
||||
regex==2021.10.23
|
||||
tomli==1.2.2
|
||||
typed-ast==1.4.3
|
||||
typing-extensions==3.10.0.2
|
||||
Werkzeug==2.0.2
|
||||
zipp==3.6.0
|
42
server.py
42
server.py
@ -5,34 +5,22 @@ from colormap import rgb2hex
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@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'
|
||||
return "Index Page"
|
||||
|
||||
@app.route('/hello')
|
||||
|
||||
@app.route("/colour")
|
||||
def hello():
|
||||
#a = rgb2hex(255, 255, 255)
|
||||
# a = request.query_string
|
||||
r = int(request.args.get("r"))
|
||||
g = int(request.args.get("g"))
|
||||
b = int(request.args.get("b"))
|
||||
hex = rgb2hex(r, g, b)
|
||||
hex = hex.replace("#", "")
|
||||
|
||||
#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
|
||||
str = "56" + hex + "00f0aa"
|
||||
os.system(
|
||||
f"gatttool -i hci0 -b b2:3b:03:00:14:d6 --char-write-req -a 0x0009 -n {str}"
|
||||
)
|
||||
return request.query_string
|
||||
|
@ -1,3 +1,3 @@
|
||||
home = /usr/bin
|
||||
include-system-site-packages = false
|
||||
version = 3.7.3
|
||||
home = C:\Users\karl.hudgell\.pyenv\pyenv-win\versions\3.7.2
|
||||
include-system-site-packages = false
|
||||
version = 3.7.2
|
||||
|
Loading…
x
Reference in New Issue
Block a user