Search Options

Results per page
Sort
Preferred Languages
Advance

Results 441 - 450 of 1,074 for Str (0.02 sec)

  1. docs_src/dataclasses/tutorial002.py

    from dataclasses import dataclass, field
    from typing import List, Union
    
    from fastapi import FastAPI
    
    
    @dataclass
    class Item:
        name: str
        price: float
        tags: List[str] = field(default_factory=list)
        description: Union[str, None] = None
        tax: Union[float, None] = None
    
    
    app = FastAPI()
    
    
    @app.get("/items/next", response_model=Item)
    async def read_next_item():
        return {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Jul 31 14:09:15 UTC 2024
    - 549 bytes
    - Viewed (0)
  2. docs_src/path_operation_configuration/tutorial002_py310.py

    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: set[str] = set()
    
    
    @app.post("/items/", response_model=Item, tags=["items"])
    async def create_item(item: Item):
        return item
    
    
    @app.get("/items/", tags=["items"])
    async def read_items():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 537 bytes
    - Viewed (0)
  3. tests/test_serialize_response_model.py

    from typing import Dict, List, Optional
    
    from fastapi import FastAPI
    from pydantic import BaseModel, Field
    from starlette.testclient import TestClient
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str = Field(alias="aliased_name")
        price: Optional[float] = None
        owner_ids: Optional[List[int]] = None
    
    
    @app.get("/items/valid", response_model=Item)
    def get_valid():
        return Item(aliased_name="valid", price=1.0)
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 4.2K bytes
    - Viewed (0)
  4. docs_src/path_operation_configuration/tutorial003_py39.py

    from typing import Union
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: set[str] = set()
    
    
    @app.post(
        "/items/",
        response_model=Item,
        summary="Create an item",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat May 14 11:59:59 UTC 2022
    - 512 bytes
    - Viewed (0)
  5. docs/ja/docs/tutorial/metadata.md

    それぞれのタグ毎にひとつの辞書を含むリストをとります。
    
    それぞれの辞書は以下をもつことができます:
    
    * `name` (**必須**): *path operations* および `APIRouter` の `tags` パラメーターで使用するのと同じタグ名である `str`。
    * `description`: タグの簡単な説明文である `str`。 Markdownで記述でき、ドキュメントUIに表示されます。
    * `externalDocs`: 外部ドキュメントを説明するための `dict`:
        * `description`: 外部ドキュメントの簡単な説明文である `str`。
        * `url` (**必須**): 外部ドキュメントのURLである `str`。
    
    ### タグのためのメタデータの作成
    
    `users` と `items` のタグを使った例でメタデータの追加を試してみましょう。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.6K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/path-params.md

    ## 🔁 💲
    
    🚥 👆 ✔️ *➡ 🛠️* 👈 📨 *➡ 🔢*, ✋️ 👆 💚 💪 ☑ *➡ 🔢* 💲 🔁, 👆 💪 ⚙️ 🐩 🐍 <abbr title="Enumeration">`Enum`</abbr>.
    
    ### ✍ `Enum` 🎓
    
    🗄 `Enum` &amp; ✍ 🎧-🎓 👈 😖 ⚪️➡️ `str` &amp; ⚪️➡️ `Enum`.
    
    😖 ⚪️➡️ `str` 🛠️ 🩺 🔜 💪 💭 👈 💲 🔜 🆎 `string` &amp; 🔜 💪 ✍ ☑.
    
    ⤴️ ✍ 🎓 🔢 ⏮️ 🔧 💲, ❔ 🔜 💪 ☑ 💲:
    
    ```Python hl_lines="1  6-9"
    {!../../docs_src/path_params/tutorial005.py!}
    ```
    
    /// info
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  7. docs_src/body_multiple_params/tutorial001_py310.py

    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 = Path(title="The ID of the item to get", ge=0, le=1000),
        q: str | None = None,
        item: Item | None = None,
    ):
        results = {"item_id": item_id}
        if q:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri May 13 23:38:22 UTC 2022
    - 546 bytes
    - Viewed (0)
  8. tests/test_validate_response_recursive/app_pv1.py

    class RecursiveItem(BaseModel):
        sub_items: List["RecursiveItem"] = []
        name: str
    
    
    RecursiveItem.update_forward_refs()
    
    
    class RecursiveSubitemInSubmodel(BaseModel):
        sub_items2: List["RecursiveItemViaSubmodel"] = []
        name: str
    
    
    class RecursiveItemViaSubmodel(BaseModel):
        sub_items1: List[RecursiveSubitemInSubmodel] = []
        name: str
    
    
    RecursiveSubitemInSubmodel.update_forward_refs()
    
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 1.1K bytes
    - Viewed (0)
  9. scripts/label_approved.py

    
    class LabelSettings(BaseModel):
        await_label: str | None = None
        number: int
    
    
    default_config = {"approved-2": LabelSettings(await_label="awaiting-review", number=2)}
    
    
    class Settings(BaseSettings):
        github_repository: str
        token: SecretStr
        debug: bool | None = False
        config: dict[str, LabelSettings] | Literal[""] = default_config
    
    
    settings = Settings()
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Oct 12 13:58:30 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  10. tests/test_security_api_key_query_description.py

    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    api_key = APIKeyQuery(name="key", description="API Key Query")
    
    
    class User(BaseModel):
        username: str
    
    
    def get_current_user(oauth_header: str = Security(api_key)):
        user = User(username=oauth_header)
        return user
    
    
    @app.get("/users/me")
    def read_current_user(current_user: User = Depends(get_current_user)):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2K bytes
    - Viewed (0)
Back to top