Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1411 - 1420 of 1,977 for Fastapi (0.05 sec)

  1. tests/test_tutorial/test_handling_errors/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.handling_errors.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_get():
        response = client.get("/unicorns/shinny")
        assert response.status_code == 200, response.text
        assert response.json() == {"unicorn_name": "shinny"}
    
    
    def test_get_exception():
        response = client.get("/unicorns/yolo")
        assert response.status_code == 418, response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.2K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_query_params_str_validations/test_tutorial012.py

    from fastapi.testclient import TestClient
    
    from docs_src.query_params_str_validations.tutorial012 import app
    
    client = TestClient(app)
    
    
    def test_default_query_values():
        url = "/items/"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": ["foo", "bar"]}
    
    
    def test_multi_query_values():
        url = "/items/?q=baz&q=foobar"
        response = client.get(url)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_query_params_str_validations/test_tutorial013_an.py

    from fastapi.testclient import TestClient
    
    from docs_src.query_params_str_validations.tutorial013_an import app
    
    client = TestClient(app)
    
    
    def test_multi_query_values():
        url = "/items/?q=foo&q=bar"
        response = client.get(url)
        assert response.status_code == 200, response.text
        assert response.json() == {"q": ["foo", "bar"]}
    
    
    def test_query_no_values():
        url = "/items/"
        response = client.get(url)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  4. docs/pt/docs/advanced/events.md

    No nosso exemplo de código acima, nós não usamos ele diretamente, mas nós passamos para o FastAPI para ele usá-lo.
    
    O parâmetro `lifespan` da aplicação `FastAPI` usa um **Gerenciador de Contexto Assíncrono**, então nós podemos passar nosso novo gerenciador de contexto assíncrono do `lifespan` para ele.
    
    ```Python hl_lines="22"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8.6K bytes
    - Viewed (0)
  5. docs/de/docs/tutorial/body-nested-models.md

    # Body – Verschachtelte Modelle
    
    Mit **FastAPI** können Sie (dank Pydantic) beliebig tief verschachtelte Modelle definieren, validieren und dokumentieren.
    
    ## Listen als Felder
    
    Sie können ein Attribut als Kindtyp definieren, zum Beispiel eine Python-`list`e.
    
    //// tab | Python 3.10+
    
    ```Python hl_lines="12"
    {!> ../../docs_src/body_nested_models/tutorial001_py310.py!}
    ```
    
    ////
    
    //// tab | Python 3.8+
    
    ```Python hl_lines="14"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10.3K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/events.md

    In our code example above, we don't use it directly, but we pass it to FastAPI for it to use it.
    
    The `lifespan` parameter of the `FastAPI` app takes an **async context manager**, so we can pass our new `lifespan` async context manager to it.
    
    {* ../../docs_src/events/tutorial003.py hl[22] *}
    
    ## Alternative Events (deprecated)
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Oct 28 10:36:22 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  7. docs/ja/docs/tutorial/response-status-code.md

    ///
    
    これは:
    
    * レスポンスでステータスコードを返します。
    * OpenAPIスキーマ(およびユーザーインターフェース)に以下のように文書化します:
    
    <img src="https://fastapi.tiangolo.com/img/tutorial/response-status-code/image01.png">
    
    /// note | "備考"
    
    いくつかのレスポンスコード(次のセクションを参照)は、レスポンスにボディがないことを示しています。
    
    FastAPIはこれを知っていて、レスポンスボディがないというOpenAPIドキュメントを生成します。
    
    ///
    
    ## HTTPステータスコードについて
    
    /// note | "備考"
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.6K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_request_form_models/test_tutorial002_an.py

    import pytest
    from fastapi.testclient import TestClient
    
    from tests.utils import needs_pydanticv2
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.request_form_models.tutorial002_an import app
    
        client = TestClient(app)
        return client
    
    
    @needs_pydanticv2
    def test_post_body_form(client: TestClient):
        response = client.post("/login/", data={"username": "Foo", "password": "secret"})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Sep 06 17:31:18 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_request_form_models/test_tutorial002_pv1.py

    import pytest
    from fastapi.testclient import TestClient
    
    from tests.utils import needs_pydanticv1
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.request_form_models.tutorial002_pv1 import app
    
        client = TestClient(app)
        return client
    
    
    @needs_pydanticv1
    def test_post_body_form(client: TestClient):
        response = client.post("/login/", data={"username": "Foo", "password": "secret"})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Sep 06 17:31:18 UTC 2024
    - 6K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_request_files/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.request_files.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_post_files(tmp_path):
        path = tmp_path / "test.txt"
        path.write_bytes(b"<file content>")
        path2 = tmp_path / "test2.txt"
        path2.write_bytes(b"<file content2>")
    
        client = TestClient(app)
        with path.open("rb") as file, path2.open("rb") as file2:
            response = client.post(
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 7.1K bytes
    - Viewed (0)
Back to top