FastAPI
HTTP APIs with typed request and response models, from routing to a database.
6 chapters, about 1 hours of study. Part of the free Learn Python course.
- HTTP basics1. FastAPI tutorial: first app, routes, path and query parametersInstall FastAPI, write a first API, map methods and paths to functions, validate path and query parameters, read 422 errors and test routes.13 min study
- HTTP basics2. FastAPI request body and response models with PydanticValidate JSON bodies with Pydantic models, Field constraints, nested models and validators, filter output with response_model and design PATCH.13 min study
- HTTP basics3. FastAPI responses: status codes, errors, files, cookiesChoose status codes, raise HTTPException and custom error handlers, return HTML, files and streams, redirect correctly, and use headers and cookies.15 min study
- HTTP basics4. FastAPI forms, Jinja2 templates, file uploads and static filesHandle HTML form posts with Form(), re-render templates with errors, redirect with 303, accept file uploads with UploadFile and serve CSS with StaticFiles.15 min study
- Building an API5. FastAPI CRUD API: routers, dependencies, 404, 409, PATCHBuild a create, read, update and delete API with APIRouter, Depends, pagination, Location headers, 404 and 409 errors and safe PATCH merging.15 min study
- Building an API6. FastAPI with SQLAlchemy: models, sessions and testingStore FastAPI data with SQLAlchemy 2: typed ORM models, a session per request, commits and IntegrityError, lifespan setup, migrations and tests.15 min study