Search Options

Results per page
Sort
Preferred Languages
Advance

Results 301 - 310 of 1,058 for Fstr (0.01 sec)

  1. tests/test_ws_dependencies.py

    from typing import Annotated
    
    from fastapi import APIRouter, Depends, FastAPI, WebSocket
    from fastapi.testclient import TestClient
    
    
    def dependency_list() -> list[str]:
        return []
    
    
    DepList = Annotated[list[str], Depends(dependency_list)]
    
    
    def create_dependency(name: str):
        def fun(deps: DepList):
            deps.append(name)
    
        return Depends(fun)
    
    
    router = APIRouter(dependencies=[create_dependency("router")])
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 2.1K bytes
    - Viewed (0)
  2. tests/test_sub_callbacks.py

    from fastapi.testclient import TestClient
    from pydantic import BaseModel, HttpUrl
    
    app = FastAPI()
    
    
    class Invoice(BaseModel):
        id: str
        title: Optional[str] = None
        customer: str
        total: float
    
    
    class InvoiceEvent(BaseModel):
        description: str
        paid: bool
    
    
    class InvoiceEventReceived(BaseModel):
        ok: bool
    
    
    invoices_callback_router = APIRouter()
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 12.9K bytes
    - Viewed (0)
  3. docs_src/extra_models/tutorial004_py39.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str
    
    
    items = [
        {"name": "Foo", "description": "There comes my hero"},
        {"name": "Red", "description": "It's my aeroplane"},
    ]
    
    
    @app.get("/items/", response_model=list[Item])
    async def read_items():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 356 bytes
    - Viewed (0)
  4. docs_src/settings/app03_py39/config.py

    from pydantic_settings import BaseSettings, SettingsConfigDict
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
        items_per_user: int = 50
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 235 bytes
    - Viewed (0)
  5. docs_src/settings/app03_py39/config_pv1.py

    from pydantic.v1 import BaseSettings
    
    
    class Settings(BaseSettings):
        app_name: str = "Awesome API"
        admin_email: str
        items_per_user: int = 50
    
        class Config:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 198 bytes
    - Viewed (0)
  6. docs_src/pydantic_v1_in_v2/tutorial001_an_py39.py

    from typing import Union
    
    from pydantic.v1 import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 156 bytes
    - Viewed (0)
  7. tests/test_security_scopes_sub_dependency.py

        }
    
    
    @pytest.fixture(name="app")
    def app_fixture(call_counts: dict[str, int]):
        def get_db_session():
            call_counts["get_db_session"] += 1
            return f"db_session_{call_counts['get_db_session']}"
    
        def get_current_user(
            security_scopes: SecurityScopes,
            db_session: Annotated[str, Depends(get_db_session)],
        ):
            call_counts["get_current_user"] += 1
            return {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 2.9K bytes
    - Viewed (0)
  8. docs_src/query_params/tutorial005_py39.py

    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    async def read_user_item(item_id: str, needy: str):
        item = {"item_id": item_id, "needy": needy}
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 192 bytes
    - Viewed (0)
  9. docs_src/body_updates/tutorial001_py39.py

    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: Union[str, None] = None
        description: Union[str, None] = None
        price: Union[float, None] = None
        tax: float = 10.5
        tags: list[str] = []
    
    
    items = {
        "foo": {"name": "Foo", "price": 50.2},
        "bar": {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 900 bytes
    - Viewed (0)
  10. tests/test_security_scopes.py

    @pytest.fixture(name="app")
    def app_fixture(call_counter: dict[str, int]):
        def get_db():
            call_counter["count"] += 1
            return f"db_{call_counter['count']}"
    
        def get_user(db: Annotated[str, Depends(get_db)]):
            return "user"
    
        app = FastAPI()
    
        @app.get("/")
        def endpoint(
            db: Annotated[str, Depends(get_db)],
            user: Annotated[str, Security(get_user, scopes=["read"])],
        ):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1006 bytes
    - Viewed (0)
Back to top