Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1371 - 1380 of 1,977 for Fastapi (0.24 sec)

  1. tests/test_tutorial/test_request_files/test_tutorial001_03_an.py

    from fastapi.testclient import TestClient
    
    from docs_src.request_files.tutorial001_03_an import app
    
    client = TestClient(app)
    
    
    def test_post_file(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
    
        client = TestClient(app)
        with path.open("rb") as file:
            response = client.post("/files/", files={"file": file})
        assert response.status_code == 200, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 6K bytes
    - Viewed (0)
  2. docs/pt/docs/tutorial/path-params.md

    ```
    
    /// check | "Verifique"
    
    
    
    ///
    
    	Observe que o valor recebido pela função (e também retornado por ela) é `3`, como um Python `int`, não como uma string `"3"`.
    
    	Então, com essa declaração de tipo, o **FastAPI** dá pra você um <abbr title="convertendo a string que veio do request HTTP em um dado Python">"parsing"</abbr> automático no request .
    
    ## Validação de dados
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.8K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_extending_openapi/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.extending_openapi.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test():
        response = client.get("/items/")
        assert response.status_code == 200, response.text
        assert response.json() == [{"name": "Foo"}]
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  4. docs/de/docs/tutorial/query-params-str-validations.md

    ////
    
    Der Query-Parameter `q` hat den Typ `Union[str, None]` (oder `str | None` in Python 3.10), was bedeutet, er ist entweder ein `str` oder `None`. Der Defaultwert ist `None`, also weiß FastAPI, der Parameter ist nicht erforderlich.
    
    /// note | "Hinweis"
    
    FastAPI weiß nur dank des definierten Defaultwertes `=None`, dass der Wert von `q` nicht erforderlich ist
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 27.2K bytes
    - Viewed (0)
  5. docs/ko/docs/tutorial/query-params-str-validations.md

    **FastAPI**를 사용하면 매개변수에 대한 추가 정보 및 검증을 선언할 수 있습니다.
    
    이 응용 프로그램을 예로 들어보겠습니다:
    
    ```Python hl_lines="9"
    {!../../docs_src/query_params_str_validations/tutorial001.py!}
    ```
    
    쿼리 매개변수 `q`는 `Optional[str]` 자료형입니다. 즉, `str` 자료형이지만 `None` 역시 될 수 있음을 뜻하고, 실제로 기본값은 `None`이기 때문에 FastAPI는 이 매개변수가 필수가 아니라는 것을 압니다.
    
    /// note | "참고"
    
    FastAPI는 `q`의 기본값이 `= None`이기 때문에 필수가 아님을 압니다.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.5K bytes
    - Viewed (0)
  6. docs/zh/docs/deployment/index.md

    # 部署
    
    部署 **FastAPI** 应用程序相对容易。
    
    ## 部署是什么意思
    
    **部署**应用程序意味着执行必要的步骤以使其**可供用户使用**。
    
    对于**Web API**来说,通常涉及将上传到**云服务器**中,搭配一个性能和稳定性都不错的**服务器程序**,以便你的**用户**可以高效地**访问**你的应用程序,而不会出现中断或其他问题。
    
    这与**开发**阶段形成鲜明对比,在**开发**阶段,你不断更改代码、破坏代码、修复代码, 来回停止和重启服务器等。
    
    ## 部署策略
    
    根据你的使用场景和使用的工具,有多种方法可以实现此目的。
    
    你可以使用一些工具自行**部署服务器**,你也可以使用能为你完成部分工作的**云服务**,或其他可能的选项。
    
    我将向你展示在部署 **FastAPI** 应用程序时你可能应该记住的一些主要概念(尽管其中大部分适用于任何其他类型的 Web 应用程序)。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Jan 09 15:37:29 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_response_model/test_tutorial003_01.py

    from dirty_equals import IsDict, IsOneOf
    from fastapi.testclient import TestClient
    
    from docs_src.response_model.tutorial003_01 import app
    
    client = TestClient(app)
    
    
    def test_post_user():
        response = client.post(
            "/user/",
            json={
                "username": "foo",
                "password": "fighter",
                "email": "******@****.***",
                "full_name": "Grave Dohl",
            },
        )
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 04 20:47:07 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_additional_responses/test_tutorial004.py

    import os
    import shutil
    
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.additional_responses.tutorial004 import app
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"id": "foo", "value": "there goes my hero"}
    
    
    def test_path_operation_img():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_response_model/test_tutorial004.py

    import pytest
    from dirty_equals import IsDict, IsOneOf
    from fastapi.testclient import TestClient
    
    from docs_src.response_model.tutorial004 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "url,data",
        [
            ("/items/foo", {"name": "Foo", "price": 50.2}),
            (
                "/items/bar",
                {"name": "Bar", "description": "The bartenders", "price": 62, "tax": 20.2},
            ),
            (
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 04 20:47:07 UTC 2023
    - 5K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002_py310.py

    import pytest
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310, needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client() -> TestClient:
        from docs_src.separate_openapi_schemas.tutorial002_py310 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_py310
    def test_create_item(client: TestClient) -> None:
        response = client.post("/items/", json={"name": "Foo"})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Aug 25 19:10:22 UTC 2023
    - 4.9K bytes
    - Viewed (0)
Back to top