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

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2025-12-04 08:29 +0000

1from fastapi import Depends, FastAPI 1abcdefg

2from fastapi.security import HTTPBasic, HTTPBasicCredentials 1abcdefg

3from typing_extensions import Annotated 1abcdefg

4 

5app = FastAPI() 1abcdefg

6 

7security = HTTPBasic() 1abcdefg

8 

9 

10@app.get("/users/me") 1abcdefg

11def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]): 1abcdefg

12 return {"username": credentials.username, "password": credentials.password} 1hijklmn