Coverage for docs_src / settings / tutorial001_py310.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1from fastapi import FastAPI 1abc

2from pydantic_settings import BaseSettings 1abc

3 

4 

5class Settings(BaseSettings): 1abc

6 app_name: str = "Awesome API" 1abc

7 admin_email: str 1abc

8 items_per_user: int = 50 1abc

9 

10 

11settings = Settings() 1abc

12app = FastAPI() 1abc

13 

14 

15@app.get("/info") 1abc

16async def info(): 1abc

17 return { 1def

18 "app_name": settings.app_name, 

19 "admin_email": settings.admin_email, 

20 "items_per_user": settings.items_per_user, 

21 }