- Sort Score
- Result 10 results
- Languages All
Results 61 - 70 of 1,926 for App (0.01 sec)
-
tests/test_response_model_include_exclude.py
age: int ref2: Model2 app = FastAPI() @app.get( "/simple_include", response_model=Model2, response_model_include={"baz": ..., "ref": {"foo"}}, ) def simple_include(): return Model2( ref=Model1(foo="simple_include model foo", bar="simple_include model bar"), baz="simple_include model2 baz", ) @app.get( "/simple_include_dict",Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Jul 19 19:14:58 UTC 2021 - 4K bytes - Viewed (0) -
docs/zh/docs/advanced/behind-a-proxy.md
`root_path` 用于处理这些特定情况。 在挂载子应用时,也可以在内部使用。 ## 移除路径前缀的代理 本例中,移除路径前缀的代理是指在代码中声明路径 `/app`,然后在应用顶层添加代理,把 **FastAPI** 应用放在 `/api/v1` 路径下。 本例的原始路径 `/app` 实际上是在 `/api/v1/app` 提供服务。 哪怕所有代码都假设只有 `/app`。 代理只在把请求传送给 Uvicorn 之前才会**移除路径前缀**,让应用以为它是在 `/app` 提供服务,因此不必在代码中加入前缀 `/api/v1`。 但之后,在(前端)打开 API 文档时,代理会要求在 `/openapi.json`,而不是 `/api/v1/openapi.json` 中提取 OpenAPI 概图。
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 10.3K bytes - Viewed (0) -
tests/test_request_params/test_header/test_optional_str.py
from pydantic import BaseModel, Field app = FastAPI() # ===================================================================================== # Without aliases @app.get("/optional-str") async def read_optional_str(p: Annotated[Optional[str], Header()] = None): return {"p": p} class HeaderModelOptionalStr(BaseModel): p: Optional[str] = None @app.get("/model-optional-str")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 8.2K bytes - Viewed (0) -
docs/debugging/healing-bin/main.go
"fmt" "io" "log" "os" "strings" "github.com/minio/cli" "github.com/tinylib/msgp/msgp" ) func main() { app := cli.NewApp() app.Copyright = "MinIO, Inc." app.Usage = "healing.bin to JSON" app.HideVersion = true app.HideHelpCommand = true app.CustomAppHelpTemplate = `NAME: {{.Name}} - {{.Usage}} USAGE: {{.Name}} {{if .VisibleFlags}}[FLAGS]{{end}} [HEALINGBINFILE|INSPECTZIPFILE]
Registered: Sun Dec 28 19:28:13 UTC 2025 - Last Modified: Fri Aug 29 02:39:48 UTC 2025 - 3.1K bytes - Viewed (0) -
tests/test_dependency_yield_scope.py
return {"status": "ok"} with TestClient(app) as client: response = client.get("/app-scope-function") assert response.status_code == 503 assert response.json() == {"detail": "Exception after yield"} def test_app_level_dep_scope_request() -> None: app = FastAPI(dependencies=[Depends(raise_after_yield, scope="request")]) @app.get("/app-scope-request") def get_app_scope_request():Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 6.7K bytes - Viewed (0) -
tests/benchmarks/test_general_performance.py
metadata: dict[str, Any] app = FastAPI() @app.post("/sync/validated", response_model=ItemOut) def sync_validated(item: ItemIn, dep: Annotated[int, Depends(dep_b)]): return ItemOut(name=item.name, value=item.value, dep=dep) @app.get("/sync/dict-no-response-model") def sync_dict_no_response_model(): return {"name": "foo", "value": 123}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 20:40:26 UTC 2025 - 11.1K bytes - Viewed (0) -
tests/test_request_params/test_body/test_required_str.py
from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/required-str", operation_id="required_str") async def read_required_str(p: Annotated[str, Body(embed=True)]): return {"p": p} class BodyModelRequiredStr(BaseModel): p: str
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 11K bytes - Viewed (0) -
tests/test_request_params/test_file/test_optional_list.py
from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/optional-list-bytes") async def read_optional_list_bytes(p: Annotated[Optional[list[bytes]], File()] = None): return {"file_size": [len(file) for file in p] if p else None} @app.post("/optional-list-uploadfile")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 10.4K bytes - Viewed (0) -
tests/test_custom_middleware_exception.py
await self.app(scope, receive, send) return wrapper = self.receive_wrapper(receive) await self.app(scope, wrapper, send) @router.post("/middleware") def run_middleware(file: UploadFile = File(..., description="Big File")): return {"message": "OK"} app.include_router(router) app.add_middleware(ContentSizeLimitMiddleware, max_content_size=2**8)Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Thu Aug 25 21:44:40 UTC 2022 - 2.8K bytes - Viewed (0) -
docs_src/sql_databases/tutorial002_py39.py
def create_db_and_tables(): SQLModel.metadata.create_all(engine) def get_session(): with Session(engine) as session: yield session app = FastAPI() @app.on_event("startup") def on_startup(): create_db_and_tables() @app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate, session: Session = Depends(get_session)): db_hero = Hero.model_validate(hero)
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 2.6K bytes - Viewed (0)