- Sort Score
- Result 10 results
- Languages All
Results 571 - 580 of 1,916 for FastApi (0.04 sec)
-
tests/test_dependency_yield_scope.py
import json from typing import Annotated, Any import pytest from fastapi import APIRouter, Depends, FastAPI, HTTPException from fastapi.exceptions import FastAPIError from fastapi.responses import StreamingResponse from fastapi.testclient import TestClient class Session: def __init__(self) -> None: self.open = True def dep_session() -> Any: s = Session() yield s s.open = FalseRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 6.7K bytes - Viewed (0) -
docs/pt/docs/advanced/custom-response.md
E será documentado como tal no OpenAPI. /// /// tip | Dica A `ORJSONResponse` está disponível apenas no FastAPI, e não no Starlette. /// ## Resposta HTML { #html-response } Para retornar uma resposta com HTML diretamente do **FastAPI**, utilize `HTMLResponse`. * Importe `HTMLResponse` * Passe `HTMLResponse` como o parâmetro de `response_class` do seu *decorador de operação de rota*.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 13.8K bytes - Viewed (0) -
docs/zh/docs/advanced/dataclasses.md
6. 这行代码返回的是包含 `items` 的字典,`items` 是数据类列表; FastAPI 仍能把数据<abbr title="把数据转换为可以传输的格式">序列化</abbr>为 JSON; 7. 这行代码中,`response_model` 的类型注解是 `Author` 数据类列表; 再一次,可以把 `dataclasses` 与标准类型注解一起使用; 8. 注意,*路径操作函数*使用的是普通函数,不是异步函数; 与往常一样,在 FastAPI 中,可以按需组合普通函数与异步函数;Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 3.7K bytes - Viewed (0) -
tests/test_generic_parameterless_depends.py
from typing import Annotated, TypeVar from fastapi import Depends, FastAPI from fastapi.testclient import TestClient app = FastAPI() T = TypeVar("T") Dep = Annotated[T, Depends()] class A: pass class B: pass @app.get("/a") async def a(dep: Dep[A]): return {"cls": dep.__class__.__name__} @app.get("/b") async def b(dep: Dep[B]): return {"cls": dep.__class__.__name__}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 1.8K bytes - Viewed (0) -
docs/de/docs/tutorial/response-model.md
### FastAPI Datenfilterung { #fastapi-data-filtering } FastAPI seinerseits wird den Rückgabetyp sehen und sicherstellen, dass das, was zurückgegeben wird, **nur** diejenigen Felder enthält, welche im Typ deklariert sind.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 24 10:28:19 UTC 2025 - 17.5K bytes - Viewed (0) -
tests/test_schema_compat_pydantic_v2.py
import pytest from fastapi import FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel from tests.utils import needs_py310 @pytest.fixture(name="client") def get_client(): from enum import Enum app = FastAPI() class PlatformRole(str, Enum): admin = "admin" user = "user" class OtherRole(str, Enum): ...
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 20 15:55:38 UTC 2025 - 2.7K bytes - Viewed (0) -
docs/zh/docs/advanced/custom-response.md
在这个例子中,HTTP 头的 `Content-Type` 会被设置成 `application/json`。 并且在 OpenAPI 文档中也会这样记录。 /// /// tip | 小贴士 `ORJSONResponse` 目前只在 FastAPI 中可用,而在 Starlette 中不可用。 /// ## HTML 响应 使用 `HTMLResponse` 来从 **FastAPI** 中直接返回一个 HTML 响应。 * 导入 `HTMLResponse`。 * 将 `HTMLResponse` 作为你的 *路径操作* 的 `response_class` 参数传入。 {* ../../docs_src/custom_response/tutorial002.py hl[2,7] *} /// info | 提示Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 7.5K bytes - Viewed (0) -
docs/ja/docs/advanced/response-directly.md
/// note | 技術詳細 また、`from starlette.responses import JSONResponse` も利用できます。 **FastAPI** は開発者の利便性のために `fastapi.responses` という `starlette.responses` と同じものを提供しています。しかし、利用可能なレスポンスのほとんどはStarletteから直接提供されます。 /// ## カスタム `Response` を返す 上記の例では必要な部分を全て示していますが、あまり便利ではありません。`item` を直接返すことができるし、**FastAPI** はそれを `dict` に変換して `JSONResponse` に含めてくれるなど。すべて、デフォルトの動作です。 では、これを使ってカスタムレスポンスをどう返すか見てみましょう。
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 3.6K bytes - Viewed (0) -
docs_src/custom_response/tutorial010_py39.py
from fastapi import FastAPI from fastapi.responses import ORJSONResponse app = FastAPI(default_response_class=ORJSONResponse) @app.get("/items/") async def read_items():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 205 bytes - Viewed (0) -
docs_src/advanced_middleware/tutorial003_py39.py
from fastapi import FastAPI from fastapi.middleware.gzip import GZipMiddleware app = FastAPI() app.add_middleware(GZipMiddleware, minimum_size=1000, compresslevel=5) @app.get("/") async def main():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 230 bytes - Viewed (0)