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

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from typing import Annotated 1abcd

2 

3from fastapi import Depends, FastAPI 1abcd

4from fastapi.security import OAuth2PasswordBearer 1abcd

5 

6app = FastAPI() 1abcd

7 

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

9 

10 

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

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

13 return {"token": token} 1abcd