Junior — Senior
Comparison of using Depends and regular function call in FastAPI
livecode
Task condition
Analyze the example on FastAPI and understand what benefits using Depends(get_current_user) provides compared to directly calling get_current_user().
# FastAPI
Depends()
@router.get('/books')
async def list_books(
user=Depends(get_current_user),
user=get_current_user()
)