Skip to content

Commit

Permalink
Fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvanes committed Oct 24, 2023
1 parent 12f6788 commit 7a17e0a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions routers/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
logger = logging.getLogger(__name__)

router = APIRouter(
prefix=BASE_PATH+"/Groups",
prefix=BASE_PATH + "/Groups",
tags=["SCIM Groups"],
)

Expand All @@ -33,7 +33,7 @@ async def get_all_groups(
@router.post("", status_code=status.HTTP_201_CREATED)
async def create_group(
group: Group = Body(
example={
examples={
"displayName": "Student",
"externalId": "[email protected]",
"members": [
Expand Down
4 changes: 2 additions & 2 deletions routers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
logger = logging.getLogger(__name__)

router = APIRouter(
prefix=BASE_PATH+"/Users",
prefix=BASE_PATH + "/Users",
tags=["SCIM Users"],
)

Expand All @@ -32,7 +32,7 @@ async def get_all_users(
@router.post("", status_code=status.HTTP_201_CREATED)
async def create_user(
user: User = Body(
example={
examples={
"externalId": "string",
"active": True,
"name": {
Expand Down
23 changes: 13 additions & 10 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse

from contextlib import asynccontextmanager

from routers import BASE_PATH, config, resource, schema, users, groups
from utils.auth import api_key_auth
from utils import host, port
Expand All @@ -18,7 +20,18 @@
logging.basicConfig(level=level)
logger = logging.getLogger(__name__)


@asynccontextmanager
async def lifespan(app: FastAPI):
# Why is this here in the first place?
pass
yield
pass

app = FastAPI(lifespan=lifespan)

app = FastAPI(
lifespan=lifespan,
title="SCIM Sample",
docs_url=BASE_PATH if BASE_PATH.startswith('/') else '/',
redoc_url=None,
Expand All @@ -38,16 +51,6 @@
app.include_router(groups.router)


@app.on_event("startup")
def startup():
pass


@app.on_event("shutdown")
def shutdown():
pass


@app.exception_handler(RequestValidationError)
async def validation_exception_handler(
request: Request,
Expand Down

0 comments on commit 7a17e0a

Please sign in to comment.