Search Options

Results per page
Sort
Preferred Languages
Advance

Results 411 - 420 of 1,074 for Str (0.03 sec)

  1. docs_src/sql_databases/tutorial001_py310.py

    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: int | None = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    sqlite_url = f"sqlite:///{sqlite_file_name}"
    
    connect_args = {"check_same_thread": False}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  2. docs_src/dataclasses/tutorial003.py

    
    @dataclass
    class Item:
        name: str
        description: Union[str, None] = None
    
    
    @dataclass
    class Author:
        name: str
        items: List[Item] = field(default_factory=list)  # (3)
    
    
    app = FastAPI()
    
    
    @app.post("/authors/{author_id}/items/", response_model=Author)  # (4)
    async def create_author_items(author_id: str, items: List[Item]):  # (5)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Jul 31 14:09:15 UTC 2024
    - 1.4K bytes
    - Viewed (0)
  3. tests/test_filter_pydantic_sub_model_pv2.py

        app = FastAPI()
    
        class ModelB(BaseModel):
            username: str
    
        class ModelC(ModelB):
            password: str
    
        class ModelA(BaseModel):
            name: str
            description: Optional[str] = None
            foo: ModelB
    
            @field_validator("name")
            def lower_username(cls, name: str, info: ValidationInfo):
                if not name.endswith("A"):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  4. fastapi/exceptions.py

                    Any data to be sent to the client in the `detail` key of the JSON
                    response.
                    """
                ),
            ] = None,
            headers: Annotated[
                Optional[Dict[str, str]],
                Doc(
                    """
                    Any headers to send to the client in the response.
                    """
                ),
            ] = None,
        ) -> None:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Apr 02 02:48:51 UTC 2024
    - 4.9K bytes
    - Viewed (0)
  5. docs_src/sql_databases/tutorial001_an_py310.py

    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: int | None = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    sqlite_url = f"sqlite:///{sqlite_file_name}"
    
    connect_args = {"check_same_thread": False}
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  6. tests/test_response_code_no_body.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class JsonApiResponse(JSONResponse):
        media_type = "application/vnd.api+json"
    
    
    class Error(BaseModel):
        status: str
        title: str
    
    
    class JsonApiError(BaseModel):
        errors: typing.List[Error]
    
    
    @app.get(
        "/a",
        status_code=204,
        response_class=JsonApiResponse,
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.2K bytes
    - Viewed (0)
  7. docs/em/docs/python-types.md

    ////
    
    πŸ‘―β€β™‚οΈ πŸ’Ό πŸ‘‰ β›“ πŸ‘ˆ `item` πŸ’ͺ `int` βš–οΈ `str`.
    
    #### 🎲 `None`
    
    πŸ‘† πŸ’ͺ πŸ“£ πŸ‘ˆ πŸ’² πŸ’ͺ βœ”οΈ πŸ†Ž, πŸ’– `str`, βœ‹οΈ πŸ‘ˆ ⚫️ πŸ’ͺ `None`.
    
    🐍 3️⃣.6️⃣ & πŸ”› (βœ… 🐍 3️⃣.1️⃣0️⃣) πŸ‘† πŸ’ͺ πŸ“£ ⚫️ 🏭 & βš™οΈ `Optional` βšͺ️➑️ `typing` πŸ•Ή.
    
    ```Python hl_lines="1  4"
    {!../../docs_src/python_types/tutorial009.py!}
    ```
    
    βš™οΈ `Optional[str]` ↩️ `str` πŸ”œ ➑️ πŸ‘¨β€πŸŽ¨ β„Ή πŸ‘† πŸ” ❌ πŸŒβ” πŸ‘† πŸ’ͺ πŸ€” πŸ‘ˆ πŸ’² πŸ•§ `str`, πŸ•β” ⚫️ πŸ’ͺ πŸ€™ `None` πŸ’β€β™‚οΈ.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 13.4K bytes
    - Viewed (0)
  8. docs_src/bigger_applications/app_an_py39/routers/items.py

    @router.get("/{item_id}")
    async def read_item(item_id: str):
        if item_id not in fake_items_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return {"name": fake_items_db[item_id]["name"], "item_id": item_id}
    
    
    @router.put(
        "/{item_id}",
        tags=["custom"],
        responses={403: {"description": "Operation forbidden"}},
    )
    async def update_item(item_id: str):
        if item_id != "plumbus":
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 1011 bytes
    - Viewed (0)
  9. docs_src/schema_extra_example/tutorial005_py310.py

    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: Item = Body(
            openapi_examples={
                "normal": {
                    "summary": "A normal example",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 26 18:03:13 UTC 2023
    - 1.3K bytes
    - Viewed (0)
  10. docs/ko/docs/tutorial/encoder.md

    같은 λ°©μ‹μœΌλ‘œ 이 λ°μ΄ν„°λ² μ΄μŠ€λŠ” Pydantic λͺ¨λΈ(속성이 μžˆλŠ” 객체)을 받지 μ•Šκ³ , `dict` λ§Œμ„ λ°›μŠ΅λ‹ˆλ‹€.
    
    이λ₯Ό μœ„ν•΄ `jsonable_encoder` λ₯Ό μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.
    
    Pydantic λͺ¨λΈκ³Ό 같은 객체λ₯Ό λ°›κ³  JSON ν˜Έν™˜ κ°€λŠ₯ν•œ λ²„μ „μœΌλ‘œ λ°˜ν™˜ν•©λ‹ˆλ‹€:
    
    ```Python hl_lines="5  22"
    {!../../docs_src/encoder/tutorial001.py!}
    ```
    
    이 μ˜ˆμ‹œλŠ” Pydantic λͺ¨λΈμ„ `dict`둜, `datetime` ν˜•μ‹μ„ `str`둜 λ³€ν™˜ν•©λ‹ˆλ‹€.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.9K bytes
    - Viewed (0)
Back to top