codejump

Lifecycle & Production Behavior — Series 2

Preview — 3 of 10 questions

A yield dependency opens a resource and must keep it alive through a streaming response. Which scope is appropriate?

Ascope="worker"
Bscope="request"
Cscope="function"
Dscope="startup"

What changes if a FastAPI app supplies a lifespan context manager and also registers startup event handlers?

AThe old startup and shutdown event handlers are not called
BBoth systems always run in registration order
COnly the startup handlers run
DThe lifespan runs once per request

What does OAuth2PasswordBearer(tokenUrl="token") do by itself?

ACreates a working /token endpoint
BVerifies JWT signatures automatically
CStores the token in a server session
DExtracts a bearer token and adds an OAuth2 security scheme to OpenAPI

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.