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

8 statements  

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

1from fastapi import Depends, FastAPI 1abcde

2from fastapi.security import HTTPBasic, HTTPBasicCredentials 1abcde

3from typing_extensions import Annotated 1abcde

4 

5app = FastAPI() 1abcde

6 

7security = HTTPBasic() 1abcde

8 

9 

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

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

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