- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for read_current_user (0.11 sec)
-
fastapi/security/http.py
from fastapi import Depends, FastAPI from fastapi.security import HTTPBasic, HTTPBasicCredentials app = FastAPI() security = HTTPBasic() @app.get("/users/me") def read_current_user(credentials: Annotated[HTTPBasicCredentials, Depends(security)]): return {"username": credentials.username, "password": credentials.password} ``` """ def __init__( self,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Sep 19 09:47:28 UTC 2024 - 13.2K bytes - Viewed (0) -
tests/test_security_oauth2.py
# Here we use string annotations to test them def login(form_data: "OAuth2PasswordRequestFormStrict" = Depends()): return form_data @app.get("/users/me") # Here we use string annotations to test them def read_current_user(current_user: "User" = Depends(get_current_user)): return current_user client = TestClient(app) def test_security_oauth2():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 10.7K bytes - Viewed (0)