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

7 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-04-06 01:24 +0000

1from fastapi import Depends, FastAPI 1abcdefgh

2from fastapi.security import OAuth2PasswordBearer 1abcdefgh

3 

4app = FastAPI() 1abcdefgh

5 

6oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") 1abcdefgh

7 

8 

9@app.get("/items/") 1abcdefgh

10async def read_items(token: str = Depends(oauth2_scheme)): 1abcdefgh

11 return {"token": token} 1ijkl