- Sort Score
- Num 10 results
- Language All
Results 161 - 170 of 795 for asyncId (0.31 seconds)
-
docs_src/path_operation_configuration/tutorial002_py310.py
tax: float | None = None tags: set[str] = set() @app.post("/items/", tags=["items"]) async def create_item(item: Item) -> Item: return item @app.get("/items/", tags=["items"]) async def read_items(): return [{"name": "Foo", "price": 42}] @app.get("/users/", tags=["users"]) async def read_users():Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 12:07:26 GMT 2026 - 524 bytes - Click Count (0) -
docs_src/security/tutorial003_an_py310.py
return user async def get_current_user(token: Annotated[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 async def get_current_active_user(
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Nov 24 19:03:06 GMT 2025 - 2.5K bytes - Click Count (0) -
docs_src/custom_request_and_route/tutorial002_py310.py
from fastapi.routing import APIRoute class ValidationErrorLoggingRoute(APIRoute): def get_route_handler(self) -> Callable: original_route_handler = super().get_route_handler() async def custom_route_handler(request: Request) -> Response: try: return await original_route_handler(request) except RequestValidationError as exc: body = await request.body()
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Dec 10 08:55:32 GMT 2025 - 935 bytes - Click Count (0) -
docs_src/dependencies/tutorial006_an_py310.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":
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 633 bytes - Click Count (0) -
docs_src/body_updates/tutorial002_py310.py
"baz": {"name": "Baz", "description": None, "price": 50.2, "tax": 10.5, "tags": []}, } @app.get("/items/{item_id}", response_model=Item) async def read_item(item_id: str): return items[item_id] @app.patch("/items/{item_id}") async def update_item(item_id: str, item: Item) -> Item: stored_item_data = items[item_id] stored_item_model = Item(**stored_item_data)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Wed Feb 04 12:07:26 GMT 2026 - 1009 bytes - Click Count (0) -
tests/test_strict_content_type_app_level.py
from fastapi import FastAPI from fastapi.testclient import TestClient app_default = FastAPI() @app_default.post("/items/") async def app_default_post(data: dict): return data app_lax = FastAPI(strict_content_type=False) @app_lax.post("/items/") async def app_lax_post(data: dict): return data client_default = TestClient(app_default) client_lax = TestClient(app_lax)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Mon Feb 23 17:45:20 GMT 2026 - 1.1K bytes - Click Count (0) -
docs/zh/docs/tutorial/dependencies/index.md
当你在**大型代码库**中,在**很多*路径操作***里反复使用**相同的依赖**时,这会特别有用。 ## 要不要使用 `async`? { #to-async-or-not-to-async } 由于依赖项也会由 **FastAPI** 调用(与*路径操作函数*相同),因此定义函数时同样的规则也适用。 你可以使用 `async def` 或普通的 `def`。 你可以在普通的 `def` *路径操作函数*中声明 `async def` 的依赖项;也可以在异步的 `async def` *路径操作函数*中声明普通的 `def` 依赖项,等等。 都没关系,**FastAPI** 知道该怎么处理。 /// note | 注意 如果不了解异步,请参阅文档中关于 `async` 和 `await` 的章节:[异步:*“着急了?”*](../../async.md#in-a-hurry)。 ///Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 8.7K bytes - Click Count (0) -
docs/ru/docs/advanced/events.md
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 17:56:20 GMT 2026 - 12.6K bytes - Click Count (0) -
docs_src/path_params/tutorial003_py310.py
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 236 bytes - Click Count (0) -
docs/es/docs/advanced/dataclasses.md
8. Nota que esta *path operation function* usa `def` regular en lugar de `async def`. Como siempre, en FastAPI puedes combinar `def` y `async def` según sea necesario. Si necesitas un repaso sobre cuándo usar cuál, revisa la sección _"¿Con prisa?"_ en la documentación sobre [`async` y `await`](../async.md#in-a-hurry).Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:15:55 GMT 2026 - 4.3K bytes - Click Count (0)