Search Options

Results per page
Sort
Preferred Languages
Advance

Results 221 - 230 of 782 for asyncio (0.06 sec)

  1. tests/test_request_params/test_path/test_required_str.py

    import pytest
    from fastapi import FastAPI, Path
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/required-str/{p}")
    async def read_required_str(p: Annotated[str, Path()]):
        return {"p": p}
    
    
    @app.get("/required-alias/{p_alias}")
    async def read_required_alias(p: Annotated[str, Path(alias="p_alias")]):
        return {"p": p}
    
    
    @app.get("/required-validation-alias/{p_val_alias}")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 2.3K bytes
    - Viewed (0)
  2. docs/ko/docs/tutorial/request-files.md

    * `close()`: 파일을 닫습니다.
    
    상기 모든 메소드들이 `async` 메소드이기 때문에 “await”을 사용하여야 합니다.
    
    예를들어, `async` *경로 작동 함수*의 내부에서 다음과 같은 방식으로 내용을 가져올 수 있습니다:
    
    ```Python
    contents = await myfile.read()
    ```
    
    만약 일반적인 `def` *경로 작동 함수*의 내부라면, 다음과 같이 `UploadFile.file` 에 직접 접근할 수 있습니다:
    
    ```Python
    contents = myfile.file.read()
    ```
    
    /// note |  "`async` 기술적 세부사항"
    
    `async` 메소드들을 사용할 때 **FastAPI**는 스레드풀에서 파일 메소드들을 실행하고 그들을 기다립니다.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 8K bytes
    - Viewed (0)
  3. docs/zh/docs/tutorial/testing.md

    /// tip | 提示
    
    注意测试函数是普通的 `def`,不是 `async def`。
    
    还有client的调用也是普通的调用,不是用 `await`。
    
    这让你可以直接使用 `pytest` 而不会遇到麻烦。
    
    ///
    
    /// note | 技术细节
    
    你也可以用 `from starlette.testclient import TestClient`。
    
    **FastAPI** 提供了和 `starlette.testclient` 一样的 `fastapi.testclient`,只是为了方便开发者。但它直接来自Starlette。
    
    ///
    
    /// tip | 提示
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 5.9K bytes
    - Viewed (0)
  4. tests/test_union_body_discriminator_annotated.py

            Discriminator(get_pet_type),
        ]
    
        app = FastAPI()
    
        @app.post("/pet/assignment")
        async def create_pet_assignment(pet: Pet = Body()):
            return pet
    
        @app.post("/pet/annotated")
        async def create_pet_annotated(pet: Annotated[Pet, Body()]):
            return pet
    
        client = TestClient(app)
        return client
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 7.7K bytes
    - Viewed (0)
  5. docs/en/docs/js/termynal.js

    /**
     * termynal.js
     * A lightweight, modern and extensible animated terminal window, using
     * async/await.
     *
     * @author Ines Montani <******@****.***>
     * @version 0.0.1
     * @license MIT
     */
    
    'use strict';
    
    /** Generate a terminal widget. */
    class Termynal {
        /**
         * Construct the widget's settings.
         * @param {(string|Node)=} container - Query selector or container element.
         * @param {Object=} options - Custom settings.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Aug 31 10:32:57 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  6. tests/test_request_params/test_query/test_list.py

    # Alias
    
    
    @app.get("/required-list-alias")
    async def read_required_list_alias(p: Annotated[list[str], Query(alias="p_alias")]):
        return {"p": p}
    
    
    class QueryModelRequiredListAlias(BaseModel):
        p: list[str] = Field(alias="p_alias")
    
    
    @app.get("/model-required-list-alias")
    async def read_model_required_list_alias(
        p: Annotated[QueryModelRequiredListAlias, Query()],
    ):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 10.9K bytes
    - Viewed (0)
  7. tests/test_request_params/test_body/test_required_str.py

    # Without aliases
    
    
    @app.post("/required-str", operation_id="required_str")
    async def read_required_str(p: Annotated[str, Body(embed=True)]):
        return {"p": p}
    
    
    class BodyModelRequiredStr(BaseModel):
        p: str
    
    
    @app.post("/model-required-str", operation_id="model_required_str")
    async def read_model_required_str(p: BodyModelRequiredStr):
        return {"p": p.p}
    
    
    @pytest.mark.parametrize(
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 11K bytes
    - Viewed (0)
  8. tests/test_request_params/test_file/test_optional_list.py

    # Without aliases
    
    
    @app.post("/optional-list-bytes")
    async def read_optional_list_bytes(p: Annotated[Optional[list[bytes]], File()] = None):
        return {"file_size": [len(file) for file in p] if p else None}
    
    
    @app.post("/optional-list-uploadfile")
    async def read_optional_list_uploadfile(
        p: Annotated[Optional[list[UploadFile]], File()] = None,
    ):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 10.4K bytes
    - Viewed (0)
  9. docs/ja/docs/tutorial/testing.md

    **FastAPI** は開発者の利便性のために `fastapi.testclient` と同じ `starlette.testclient` を提供します。しかし、実際にはStarletteから直接渡されています。
    
    ///
    
    /// tip | 豆知識
    
    FastAPIアプリケーションへのリクエストの送信とは別に、テストで `async` 関数 (非同期データベース関数など) を呼び出したい場合は、高度なチュートリアルの[Async Tests](../advanced/async-tests.md){.internal-link target=_blank} を参照してください。
    
    ///
    
    ## テストの分離
    
    実際のアプリケーションでは、おそらくテストを別のファイルに保存します。
    
    また、**FastAPI** アプリケーションは、複数のファイル/モジュールなどで構成されている場合もあります。
    
    ### **FastAPI** アプリファイル
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 5.6K bytes
    - Viewed (0)
  10. fastapi/security/http.py

            return HTTPException(
                status_code=HTTP_401_UNAUTHORIZED,
                detail="Not authenticated",
                headers=self.make_authenticate_headers(),
            )
    
        async def __call__(
            self, request: Request
        ) -> Optional[HTTPAuthorizationCredentials]:
            authorization = request.headers.get("Authorization")
            scheme, credentials = get_authorization_scheme_param(authorization)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 13.2K bytes
    - Viewed (0)
Back to top