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

11 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-05-05 00:03 +0000

1from fastapi import FastAPI 1abcdef

2from pydantic_settings import BaseSettings 1abcdef

3 

4 

5class Settings(BaseSettings): 1abcdef

6 app_name: str = "Awesome API" 1abcdef

7 admin_email: str 1abcdef

8 items_per_user: int = 50 1abcdef

9 

10 

11settings = Settings() 1abcdef

12app = FastAPI() 1abcdef

13 

14 

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

16async def info(): 1abcdef

17 return { 1abcdef

18 "app_name": settings.app_name, 

19 "admin_email": settings.admin_email, 

20 "items_per_user": settings.items_per_user, 

21 }