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

7 statements  

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

1from fastapi import Depends, FastAPI 1abc

2from fastapi.security import HTTPBasic, HTTPBasicCredentials 1abc

3 

4app = FastAPI() 1abc

5 

6security = HTTPBasic() 1abc

7 

8 

9@app.get("/users/me") 1abc

10def read_current_user(credentials: HTTPBasicCredentials = Depends(security)): 1abc

11 return {"username": credentials.username, "password": credentials.password} 1def