- Sort Score
- Result 10 results
- Languages All
Results 61 - 70 of 760 for asyncio (0.13 sec)
-
docs_src/security/tutorial005_py310.py
@app.get("/users/me/", response_model=User) async def read_users_me(current_user: User = Depends(get_current_active_user)): return current_user @app.get("/users/me/items/") async def read_own_items( current_user: User = Security(get_current_active_user, scopes=["items"]), ): return [{"item_id": "Foo", "owner": current_user.username}] @app.get("/status/")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Sep 29 02:57:38 UTC 2025 - 5.2K bytes - Viewed (0) -
docs_src/dependencies/tutorial001_02_an_py310.py
from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters(q: str | None = None, skip: int = 0, limit: int = 100): return {"q": q, "skip": skip, "limit": limit} CommonsDep = Annotated[dict, Depends(common_parameters)] @app.get("/items/") async def read_items(commons: CommonsDep): return commons @app.get("/users/") async def read_users(commons: CommonsDep):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 447 bytes - Viewed (0) -
tests/test_dependency_cache.py
counter_holder = {"counter": 0} async def dep_counter(): counter_holder["counter"] += 1 return counter_holder["counter"] async def super_dep(count: int = Depends(dep_counter)): return count @app.get("/counter/") async def get_counter(count: int = Depends(dep_counter)): return {"counter": count} @app.get("/sub-counter/") async def get_sub_counter(Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Aug 23 13:30:24 UTC 2022 - 2.7K bytes - Viewed (0) -
docs_src/dependencies/tutorial006_an_py39.py
from typing import Annotated from fastapi import Depends, FastAPI, Header, HTTPException app = FastAPI() async def verify_token(x_token: Annotated[str, Header()]): if x_token != "fake-super-secret-token": raise HTTPException(status_code=400, detail="X-Token header invalid") async def verify_key(x_key: Annotated[str, Header()]): if x_key != "fake-super-secret-key":
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 633 bytes - Viewed (0) -
docs_src/security/tutorial004_py310.py
if user is None: raise credentials_exception return user async def get_current_active_user(current_user: User = Depends(get_current_user)): if current_user.disabled: raise HTTPException(status_code=400, detail="Inactive user") return current_user @app.post("/token") async def login_for_access_token( form_data: OAuth2PasswordRequestForm = Depends(), ) -> Token:Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Sep 29 02:57:38 UTC 2025 - 4K bytes - Viewed (0) -
docs_src/security/tutorial004_py39.py
if user is None: raise credentials_exception return user async def get_current_active_user(current_user: User = Depends(get_current_user)): if current_user.disabled: raise HTTPException(status_code=400, detail="Inactive user") return current_user @app.post("/token") async def login_for_access_token( form_data: OAuth2PasswordRequestForm = Depends(), ) -> Token:Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 4.1K bytes - Viewed (0) -
tests/test_router_events.py
def test_merged_mixed_state_lifespans() -> None: @asynccontextmanager async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]: yield @asynccontextmanager async def router_lifespan(app: FastAPI) -> AsyncGenerator[dict[str, bool], None]: yield {"router": True} @asynccontextmanager async def sub_router_lifespan(app: FastAPI) -> AsyncGenerator[None, None]: yield
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 7.3K bytes - Viewed (0) -
docs_src/security/tutorial003_py39.py
return user async def get_current_user(token: str = Depends(oauth2_scheme)): user = fake_decode_token(token) if not user: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Not authenticated", headers={"WWW-Authenticate": "Bearer"}, ) return user
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 2.4K bytes - Viewed (0) -
tests/test_dependency_yield_scope_websockets.py
] app = FastAPI() @app.websocket("/function-scope") async def function_scope(websocket: WebSocket, session: SessionFuncDep) -> Any: await websocket.accept() await websocket.send_json({"is_open": session.open}) @app.websocket("/request-scope") async def request_scope(websocket: WebSocket, session: SessionRequestDep) -> Any: await websocket.accept()
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 6K bytes - Viewed (0) -
docs/ru/docs/tutorial/dependencies/index.md
## Использовать `async` или не `async` { #to-async-or-not-to-async } Поскольку зависимости также вызываются **FastAPI** (как и ваши *функции обработки пути*), применяются те же правила при определении ваших функций. Вы можете использовать `async def` или обычное `def`.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Sep 30 11:24:39 UTC 2025 - 15.4K bytes - Viewed (1)