aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael McVady <michaelm@telnyx.com>2024-01-27 21:27:38 -0600
committerMichael McVady <michaelm@telnyx.com>2024-01-27 21:27:38 -0600
commitfd17a92765c4bdc9350487a9b937eb3d4707dfa7 (patch)
tree86cf4aa2d54d420294710541d4cd5541c73f5f3e
Initial commit
-rw-r--r--app.py22
-rw-r--r--requirements.txt2
2 files changed, 24 insertions, 0 deletions
diff --git a/app.py b/app.py
new file mode 100644
index 0000000..d669836
--- /dev/null
+++ b/app.py
@@ -0,0 +1,22 @@
+from lifxlan import LifxLAN, BLUE
+
+from litestar import Litestar, get, post
+
+
+@get("/")
+async def index() -> str:
+ return "Hello, world!"
+
+
+@post("/")
+async def post_index() -> dict[str, str]:
+ lifxlan = LifxLAN()
+ try:
+ lifxlan.set_color_all_lights(BLUE, rapid=True)
+ except Exception as e:
+ return {"status": "error", "message": str(e)}
+
+ return {"status": "ok"}
+
+
+app = Litestar([index, post_index])
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..b78356f
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+lifxlan
+litestar