aboutsummaryrefslogtreecommitdiffstats
path: root/backend/routes/index.py
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-07-08 15:09:17 +0100
committerGravatar GitHub <[email protected]>2024-07-08 15:09:17 +0100
commit642c0795c8738bf8b9ae39b9cf0180f7cdbac650 (patch)
tree4a075255d00d9f8a2f369567bdb79f6eefa4be9a /backend/routes/index.py
parentMigration to official Sentry release CI action (#275) (diff)
parentStop using gunicorn and use uvicorn directly to run application (diff)
Merge pull request #276 from python-discord/jb3/environ/python-3.12
3.12 + Updates
Diffstat (limited to 'backend/routes/index.py')
-rw-r--r--backend/routes/index.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/backend/routes/index.py b/backend/routes/index.py
index 207c36a..c6e38ea 100644
--- a/backend/routes/index.py
+++ b/backend/routes/index.py
@@ -1,6 +1,5 @@
-"""
-Index route for the forms API.
-"""
+"""Index route for the forms API."""
+
import platform
from pydantic import BaseModel
@@ -20,13 +19,13 @@ class IndexResponse(BaseModel):
description=(
"The connecting client, in production this will"
" be an IP of our internal load balancer"
- )
+ ),
)
sha: str = Field(
- description="Current release Git SHA in production."
+ description="Current release Git SHA in production.",
)
node: str = Field(
- description="The node that processed the request."
+ description="The node that processed the request.",
)
@@ -42,24 +41,22 @@ class IndexRoute(Route):
@api.validate(resp=Response(HTTP_200=IndexResponse))
def get(self, request: Request) -> JSONResponse:
- """
- Return a hello from Python Discord forms!
- """
+ """Return a hello from Python Discord forms!."""
response_data = {
"message": "Hello, world!",
"client": request.client.host,
"user": {
- "authenticated": False
+ "authenticated": False,
},
"sha": GIT_SHA,
- "node": platform.uname().node
+ "node": platform.uname().node,
}
if request.user.is_authenticated:
response_data["user"] = {
"authenticated": True,
"user": request.user.payload,
- "scopes": request.auth.scopes
+ "scopes": request.auth.scopes,
}
return JSONResponse(response_data)