new rety
This commit is contained in:
parent
541fc7dc6a
commit
7440fe2aed
@ -2,12 +2,13 @@ from flask import Flask, request
|
|||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
from colormap import rgb2hex
|
from colormap import rgb2hex
|
||||||
from tenacity import *
|
from tenacity import wait_exponential, retry, stop_after_attempt
|
||||||
|
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
|
||||||
@retry
|
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
|
||||||
@app.route("/on")
|
@app.route("/on")
|
||||||
def on():
|
def on():
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
@ -22,7 +23,7 @@ def on():
|
|||||||
return "On"
|
return "On"
|
||||||
|
|
||||||
|
|
||||||
@retry
|
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
|
||||||
@app.route("/off")
|
@app.route("/off")
|
||||||
def off():
|
def off():
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
@ -37,7 +38,7 @@ def off():
|
|||||||
return "Off"
|
return "Off"
|
||||||
|
|
||||||
|
|
||||||
@retry
|
@retry(wait=wait_exponential(multiplier=2, min=2, max=30), stop=stop_after_attempt(5))
|
||||||
@app.route("/colour")
|
@app.route("/colour")
|
||||||
def hello():
|
def hello():
|
||||||
# a = request.query_string
|
# a = request.query_string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user