Coverage for docs_src/security/tutorial006.py: 100%
7 statements
« prev ^ index » next coverage.py v7.6.1, created at 2025-12-04 08:29 +0000
« 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
4app = FastAPI() 1abcdefg
6security = HTTPBasic() 1abcdefg
9@app.get("/users/me") 1abcdefg
10def read_current_user(credentials: HTTPBasicCredentials = Depends(security)): 1abcdefg
11 return {"username": credentials.username, "password": credentials.password} 1hijklmn