Search Options

Results per page
Sort
Preferred Languages
Advance

Results 751 - 760 of 877 for tutorial002 (0.08 sec)

  1. tests/test_tutorial/test_security/test_tutorial006.py

    from base64 import b64encode
    
    from fastapi.testclient import TestClient
    
    from docs_src.security.tutorial006 import app
    
    client = TestClient(app)
    
    
    def test_security_http_basic():
        response = client.get("/users/me", auth=("john", "secret"))
        assert response.status_code == 200, response.text
        assert response.json() == {"username": "john", "password": "secret"}
    
    
    def test_security_http_basic_no_credentials():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 2.3K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_configure_swagger_ui/test_tutorial003.py

    from fastapi.testclient import TestClient
    
    from docs_src.configure_swagger_ui.tutorial003 import app
    
    client = TestClient(app)
    
    
    def test_swagger_ui():
        response = client.get("/docs")
        assert response.status_code == 200, response.text
        assert (
            '"deepLinking": false,' in response.text
        ), "overridden configs should be preserved"
        assert (
            '"deepLinking": true' not in response.text
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 19 19:54:04 UTC 2023
    - 1.5K bytes
    - Viewed (0)
  3. 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)
  4. docs/em/docs/tutorial/debugging.md

    # ๐Ÿ› ๏ธ
    
    ๐Ÿ‘† ๐Ÿ’ช ๐Ÿ”— ๐Ÿ•น ๐Ÿ‘† ๐Ÿ‘จโ€๐ŸŽจ, ๐Ÿ–ผ โฎ๏ธ ๐ŸŽ™ ๐ŸŽ™ ๐Ÿ“Ÿ โš–๏ธ ๐Ÿ—’.
    
    ## ๐Ÿค™ `uvicorn`
    
    ๐Ÿ‘† FastAPI ๐Ÿˆธ, ๐Ÿ—„ & ๐Ÿƒ `uvicorn` ๐Ÿ”—:
    
    ```Python hl_lines="1  15"
    {!../../docs_src/debugging/tutorial001.py!}
    ```
    
    ### ๐Ÿ”ƒ `__name__ == "__main__"`
    
    ๐Ÿ‘‘ ๐ŸŽฏ `__name__ == "__main__"` โœ”๏ธ ๐Ÿ“Ÿ ๐Ÿ‘ˆ ๐Ÿ› ๏ธ ๐Ÿ•โ” ๐Ÿ‘† ๐Ÿ“ ๐Ÿค™ โฎ๏ธ:
    
    <div class="termy">
    
    ```console
    $ python myapp.py
    ```
    
    </div>
    
    โœ‹๏ธ ๐Ÿšซ ๐Ÿค™ ๐Ÿ•โ” โž•1๏ธโƒฃ ๐Ÿ“ ๐Ÿ—„ โšซ๏ธ, ๐Ÿ’–:
    
    ```Python
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2.1K bytes
    - Viewed (0)
  5. docs/zh/docs/tutorial/encoder.md

    //// tab | Python 3.10+
    
    ```Python hl_lines="4  21"
    {!> ../../docs_src/encoder/tutorial001_py310.py!}
    ```
    
    ////
    
    //// tab | Python 3.8+
    
    ```Python hl_lines="5  22"
    {!> ../../docs_src/encoder/tutorial001.py!}
    ```
    
    ////
    
    ๅœจ่ฟ™ไธชไพ‹ๅญไธญ๏ผŒๅฎƒๅฐ†Pydanticๆจกๅž‹่ฝฌๆขไธบ`dict`๏ผŒๅนถๅฐ†`datetime`่ฝฌๆขไธบ`str`ใ€‚
    
    ่ฐƒ็”จๅฎƒ็š„็ป“ๆžœๅŽๅฐฑๅฏไปฅไฝฟ็”จPythonๆ ‡ๅ‡†็ผ–็ ไธญ็š„<a href="https://docs.python.org/3/library/json.html#json.dumps" class="external-link" target="_blank">`json.dumps()`</a>ใ€‚
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_schema_extra_example/test_tutorial005.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.schema_extra_example.tutorial005 import app
    
        client = TestClient(app)
        return client
    
    
    def test_post_body_example(client: TestClient):
        response = client.put(
            "/items/5",
            json={
                "name": "Foo",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 26 18:03:13 UTC 2023
    - 6.7K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_query_params/test_tutorial006.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.query_params.tutorial006 import app
    
        c = TestClient(app)
        return c
    
    
    def test_foo_needy_very(client: TestClient):
        response = client.get("/items/foo?needy=very")
        assert response.status_code == 200
        assert response.json() == {
            "item_id": "foo",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  8. docs/de/docs/tutorial/dependencies/index.md

    ```
    
    ////
    
    //// tab | Python 3.8+ nicht annotiert
    
    /// tip | "Tipp"
    
    Bevorzugen Sie die `Annotated`-Version, falls mรถglich.
    
    ///
    
    ```Python hl_lines="8-11"
    {!> ../../docs_src/dependencies/tutorial001.py!}
    ```
    
    ////
    
    Das war's schon.
    
    **Zwei Zeilen**.
    
    Und sie hat die gleiche Form und Struktur wie alle Ihre *Pfadoperation-Funktionen*.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 13K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_query_params/test_tutorial005.py

    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    from docs_src.query_params.tutorial005 import app
    
    client = TestClient(app)
    
    
    def test_foo_needy_very():
        response = client.get("/items/foo?needy=very")
        assert response.status_code == 200
        assert response.json() == {"item_id": "foo", "needy": "very"}
    
    
    def test_foo_no_needy():
        response = client.get("/items/foo")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 4K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_body_multiple_params/test_tutorial001.py

    import pytest
    from dirty_equals import IsDict
    from fastapi.testclient import TestClient
    
    
    @pytest.fixture(name="client")
    def get_client():
        from docs_src.body_multiple_params.tutorial001 import app
    
        client = TestClient(app)
        return client
    
    
    def test_post_body_q_bar_content(client: TestClient):
        response = client.put("/items/5?q=bar", json={"name": "Foo", "price": 50.5})
        assert response.status_code == 200
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 7.5K bytes
    - Viewed (0)
Back to top