Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 361 - 370 of 795 for asyncId (0.07 seconds)

  1. docs/ja/docs/tutorial/request-files.md

    - `close()`: ファイルを閉じます。
    
    これらはすべて `async` メソッドなので、`await` する必要があります。
    
    例えば、`async` の *path operation 関数* 内では次のように内容を取得できます:
    
    ```Python
    contents = await myfile.read()
    ```
    
    通常の `def` の *path operation 関数* 内にいる場合は、`UploadFile.file` に直接アクセスできます。例えば:
    
    ```Python
    contents = myfile.file.read()
    ```
    
    /// note | `async` の技術詳細
    
    `async` メソッドを使うと、**FastAPI** はファイルメソッドをスレッドプールで実行し、その完了を待機します。
    
    ///
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 8.7K bytes
    - Click Count (0)
  2. docs_src/query_params_str_validations/tutorial004_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[
            str | None, Query(min_length=3, max_length=50, pattern="^fixedquery$")
        ] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 368 bytes
    - Click Count (0)
  3. tests/test_request_body_parameters_media_type.py

    class Product(BaseModel):
        name: str
        price: float
    
    
    class Shop(BaseModel):
        name: str
    
    
    @app.post("/products")
    async def create_product(data: Product = Body(media_type=media_type, embed=True)):
        pass  # pragma: no cover
    
    
    @app.post("/shops")
    async def create_shop(
        data: Shop = Body(media_type=media_type),
        included: list[Product] = Body(default=[], media_type=media_type),
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 7.2K bytes
    - Click Count (0)
  4. docs_src/settings/app02_an_py310/main.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI
    
    from .config import Settings
    
    app = FastAPI()
    
    
    @lru_cache
    def get_settings():
        return Settings()
    
    
    @app.get("/info")
    async def info(settings: Annotated[Settings, Depends(get_settings)]):
        return {
            "app_name": settings.app_name,
            "admin_email": settings.admin_email,
            "items_per_user": settings.items_per_user,
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 445 bytes
    - Click Count (0)
  5. docs_src/path_operation_configuration/tutorial001_py310.py

    
    class Item(BaseModel):
        name: str
        description: str | None = None
        price: float
        tax: float | None = None
        tags: set[str] = set()
    
    
    @app.post("/items/", status_code=status.HTTP_201_CREATED)
    async def create_item(item: Item) -> Item:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Feb 04 12:07:26 GMT 2026
    - 350 bytes
    - Click Count (0)
  6. docs_src/header_param_models/tutorial001_an_py310.py

    
    class CommonHeaders(BaseModel):
        host: str
        save_data: bool
        if_modified_since: str | None = None
        traceparent: str | None = None
        x_tag: list[str] = []
    
    
    @app.get("/items/")
    async def read_items(headers: Annotated[CommonHeaders, Header()]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Sep 17 18:54:10 GMT 2024
    - 392 bytes
    - Click Count (0)
  7. docs_src/query_param_models/tutorial001_an_py310.py

    class FilterParams(BaseModel):
        limit: int = Field(100, gt=0, le=100)
        offset: int = Field(0, ge=0)
        order_by: Literal["created_at", "updated_at"] = "created_at"
        tags: list[str] = []
    
    
    @app.get("/items/")
    async def read_items(filter_query: Annotated[FilterParams, Query()]):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Sep 17 18:54:10 GMT 2024
    - 443 bytes
    - Click Count (0)
  8. docs_src/query_params_str_validations/tutorial008_py310.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: str | None = Query(
            default=None,
            title="Query string",
            description="Query string for the items to search in the database that have a good match",
            min_length=3,
        ),
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 434 bytes
    - Click Count (0)
  9. docs_src/dependencies/tutorial005_an_py310.py

        q: Annotated[str, Depends(query_extractor)],
        last_query: Annotated[str | None, Cookie()] = None,
    ):
        if not q:
            return last_query
        return q
    
    
    @app.get("/items/")
    async def read_query(
        query_or_default: Annotated[str, Depends(query_or_cookie_extractor)],
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 510 bytes
    - Click Count (0)
  10. docs_src/schema_extra_example/tutorial001_py310.py

                        "description": "A very nice Item",
                        "price": 35.4,
                        "tax": 3.2,
                    }
                ]
            }
        }
    
    
    @app.put("/items/{item_id}")
    async def update_item(item_id: int, item: Item):
        results = {"item_id": item_id, "item": item}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 646 bytes
    - Click Count (0)
Back to Top