new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

explore / Backend & APIs / mozg / FastAPI

FastAPI · Tutorial

Answer questions from the FastAPI tutorial: path and query parameters with their validation options, request bodies and response models, dependencies, security, middleware, static files, testing and debugging — each with working code shapes.

493 notes · updated 2026-08-09 · trained 80%

use this brain
# sign in to get a token
$ claude mcp add --transport http mozg \
https://mozg.sh/mcp --header "Authorization: Bearer …"
> use mozg/fastapi-tutorial — …
Sign in — get this command with your token in it

New here? Sign in and this exact command appears with your token already inside — copy, paste into your terminal, done.

Or just add it

Sign in and add it, and every agent you have connected can read it — nothing to download, and it stays current as the author updates it.

Sign in to add it

Ask it things like

answers 24/30 on its latest exam
How do you create a reusable dependency that queries a database and needs cleanup?Dependencies
What is the difference between a path parameter and a query parameter in FastAPI?Path & Query Parameters
What happens if a dependency is used in multiple path operations on the same request?Dependencies
What is the execution order of middleware in FastAPI?Middleware & Headers
How do you restrict a path parameter to only specific predefined values?Path & Query Parameters
Can you make a query parameter optional with None as default?Path & Query Parameters
How do you declare a path parameter that allows forward slashes, like for file paths?Path & Query Parameters
What happens when you use PUT to update an endpoint but don't send all fields?Request Bodies & Validation

What it can answer

30 coverage checks
80%
Answers 24 of the exam's 30 questions
Path & Query Parameters5 / 5
Response Models4 / 4
Dependencies3 / 4
Request Bodies & Validation3 / 4
Security2 / 3
Static Files & Frontend2 / 2
Testing2 / 2
Advanced Features1 / 1
File Uploads & Forms1 / 3
Middleware & Headers1 / 2
exam badge — share this score →

Attacks survived

re-run weekly · 2026-08-11
gate-battery12/12 known hostile payloads caught by the ingest gate
injection-corpusevery active note scanned — no steering language
secret-corpusevery active note scanned — no keys or credentials

heuristic scans against known attack classes — measured and dated, not a promise of unpoisonability

Inside

  • TestClient receives JSON-convertible data, not Pydantic models · testing
  • Async tests in FastAPI · testing
  • Passing JSON body in tests · testing
  • Passing cookies in tests · testing
  • Running pytest from command line · testing
  • Testing functions use regular def, not async def · testing
  • TestClient behaves like httpx · testing
  • Passing path and query parameters in tests · testing
  • Passing form data in tests · testing
  • Passing headers in tests · testing
  • pytest test function naming convention · testing
  • Test file location in larger applications · testing
  • TestClient import and setup · testing
  • Performance benefit of declaring return type for JSON Lines · streaming

Licence

CC BY-NC-SA 4.0

Use it, copy it, build on it, with credit. Selling it is not allowed.