- Sort Score
- Result 10 results
- Languages All
Results 231 - 240 of 498 for Annotated (0.05 sec)
-
tests/test_dependency_after_yield_streaming.py
with acquire_session() as s: yield s def broken_dep_session() -> Any: with acquire_session() as s: s.open = False yield s SessionDep = Annotated[Session, Depends(dep_session)] BrokenSessionDep = Annotated[Session, Depends(broken_dep_session)] app = FastAPI() @app.get("/data") def get_data(session: SessionDep) -> Any: data = list(session) return data
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 3.2K bytes - Viewed (0) -
docs_src/dependencies/tutorial008d_an_py39.py
from typing import Annotated from fastapi import Depends, FastAPI, HTTPException app = FastAPI() class InternalError(Exception): pass def get_username(): try: yield "Rick" except InternalError: print("We don't swallow the internal error here, we raise again π") raise @app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 734 bytes - Viewed (0) -
docs/zh/docs/tutorial/testing.md
``` //// //// tab | Python 3.10+ non-Annotated /// tip | ζη€Ί Prefer to use the `Annotated` version if possible. /// ```Python {!> ../../docs_src/app_testing/app_b_py310/main.py!} ``` //// //// tab | Python 3.8+ non-Annotated /// tip | ζη€Ί Prefer to use the `Annotated` version if possible. /// ```PythonRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Oct 11 17:48:49 UTC 2025 - 5.9K bytes - Viewed (0) -
docs_src/custom_request_and_route/tutorial001_an_py39.py
import gzip from typing import Annotated, Callable from fastapi import Body, FastAPI, Request, Response from fastapi.routing import APIRoute class GzipRequest(Request): async def body(self) -> bytes: if not hasattr(self, "_body"): body = await super().body() if "gzip" in self.headers.getlist("Content-Encoding"): body = gzip.decompress(body) self._body = body
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 08:55:32 UTC 2025 - 988 bytes - Viewed (0) -
docs_src/dependencies/tutorial014_an_py310.py
import time from typing import Annotated from fastapi import Depends, FastAPI, HTTPException from fastapi.responses import StreamingResponse from sqlmodel import Field, Session, SQLModel, create_engine engine = create_engine("postgresql+psycopg://postgres:postgres@localhost/db") class User(SQLModel, table=True): id: int | None = Field(default=None, primary_key=True) name: str app = FastAPI() def get_session():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Sep 29 03:29:38 UTC 2025 - 957 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial005_an_py310.py
from typing import Annotated from fastapi import Body, FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None @app.put("/items/{item_id}") async def update_item( *, item_id: int, item: Annotated[ Item, Body( openapi_examples={
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Aug 26 18:03:13 UTC 2023 - 1.5K bytes - Viewed (0) -
tests/test_request_params/test_body/test_list.py
from typing import Annotated, Union import pytest from dirty_equals import IsOneOf, IsPartialDict from fastapi import Body, FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, Field from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:31:34 UTC 2025 - 11.9K bytes - Viewed (0) -
tests/test_request_params/test_body/test_optional_str.py
from typing import Annotated, Optional import pytest from fastapi import Body, FastAPI from fastapi.testclient import TestClient from pydantic import BaseModel, Field from .utils import get_body_model_name app = FastAPI() # ===================================================================================== # Without aliases @app.post("/optional-str", operation_id="optional_str")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 11.6K bytes - Viewed (0) -
docs/ko/docs/tutorial/dependencies/index.md
λ¨μν `Depends`μ λκ²¨μ£ΌκΈ°λ§ νλ©΄ λλ©°, **FastAPI**λ λλ¨Έμ§λ₯Ό μ΄μ°ν μ§ μκ³ μμ΅λλ€. /// ## `Annotated`μΈ μμ‘΄μ± κ³΅μ νκΈ° μμ μμ μμ λͺλͺ μμ **μ½λ μ€λ³΅**μ΄ μλ€λ κ²μ 보μμ κ²λλ€. `common_parameters()`μμ‘΄μ μ¬μ©ν΄μΌ νλ€λ©΄, νμ λͺ μμ `Depends()`μ ν¨κ» μ 체 λ§€κ°λ³μλ₯Ό μ μ΄μΌ ν©λλ€: ```Python commons: Annotated[dict, Depends(common_parameters)] ``` νμ§λ§ `Annotated`λ₯Ό μ¬μ©νκ³ μκΈ°μ, `Annotated` κ°μ λ³μμ μ μ₯νκ³ μ¬λ¬ μ₯μμμ μ¬μ©ν μ μμ΅λλ€:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 11.1K bytes - Viewed (0) -
tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py
# Ref: https://github.com/fastapi/fastapi/issues/14454 from typing import Annotated from fastapi import Depends, FastAPI, Security from fastapi.security import OAuth2AuthorizationCodeBearer from fastapi.testclient import TestClient from inline_snapshot import snapshot oauth2_scheme = OAuth2AuthorizationCodeBearer( authorizationUrl="api/oauth/authorize", tokenUrl="/api/oauth/token", scopes={"read": "Read access", "write": "Write access"},
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 2.6K bytes - Viewed (0)