Junior — Senior
Differences between using Depends and direct function call
livecode
Task condition
Let's consider an example in FastAPI demonstrating the advantages of using Depends(get_current_user) instead of directly calling get_current_user().
# FastAPI
Depends()
@route.get('...')
async def get_books(
current_user=Depends(get_current_user),
current_user=get_current_user()
)