Ongoing changes
This commit is contained in:
@@ -1,7 +1,18 @@
|
||||
from fastapi import FastAPI, Path, HTTPException, status
|
||||
from fastapi.responses import RedirectResponse
|
||||
from projectorpi.cli import ProjectorSerial, ExtronSerial
|
||||
from pydantic import BaseModel
|
||||
from time import sleep
|
||||
from http import HTTPStatus
|
||||
import sentry_sdk
|
||||
|
||||
sentry_sdk.init(
|
||||
dsn="https://8dce3a0f69f643c0a3547b8baf19d00b@sentry.marijndoeve.nl/3",
|
||||
# Set traces_sample_rate to 1.0 to capture 100%
|
||||
# of transactions for performance monitoring.
|
||||
# We recommend adjusting this value in production,
|
||||
traces_sample_rate=1.0,
|
||||
)
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@@ -14,6 +25,11 @@ class Response(BaseModel):
|
||||
error: str | None = None
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def index() -> RedirectResponse:
|
||||
return RedirectResponse("/docs", HTTPStatus.MOVED_PERMANENTLY)
|
||||
|
||||
|
||||
@app.post("/sleep", response_model=Response)
|
||||
async def sleep_post() -> Response:
|
||||
extron.sleep()
|
||||
|
||||
Reference in New Issue
Block a user