Coverage for docs_src / security / tutorial001_an_py310.py: 100%

8 statements  

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

1from typing import Annotated 1abc

2 

3from fastapi import Depends, FastAPI 1abc

4from fastapi.security import OAuth2PasswordBearer 1abc

5 

6app = FastAPI() 1abc

7 

8oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") 1abc

9 

10 

11@app.get("/items/") 1abc

12async def read_items(token: Annotated[str, Depends(oauth2_scheme)]): 1abc

13 return {"token": token} 1def