This commit is contained in:
karl.hudgell 2021-10-26 15:52:27 +01:00
parent 541fc7dc6a
commit 7440fe2aed

View File

@ -2,12 +2,13 @@ from flask import Flask, request
import os
import subprocess
from colormap import rgb2hex
from tenacity import *
from tenacity import wait_exponential, retry, stop_after_attempt
app = Flask(__name__)
@retry
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
@app.route("/on")
def on():
result = subprocess.run(
@ -22,7 +23,7 @@ def on():
return "On"
@retry
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
@app.route("/off")
def off():
result = subprocess.run(
@ -37,7 +38,7 @@ def off():
return "Off"
@retry
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
@app.route("/colour")
def hello():
# a = request.query_string