Search Options

Results per page
Sort
Preferred Languages
Advance

Results 241 - 250 of 874 for tutorial001 (0.06 sec)

  1. tests/test_tutorial/test_behind_a_proxy/test_tutorial001.py

    from fastapi.testclient import TestClient
    
    from docs_src.behind_a_proxy.tutorial001 import app
    
    client = TestClient(app, root_path="/api/v1")
    
    
    def test_main():
        response = client.get("/app")
        assert response.status_code == 200
        assert response.json() == {"message": "Hello World", "root_path": "/api/v1"}
    
    
    def test_openapi():
        response = client.get("/openapi.json")
        assert response.status_code == 200
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1K bytes
    - Viewed (0)
  2. docs/en/docs/how-to/custom-docs-ui-assets.md

    The first step is to disable the automatic docs, as by default, those use the default CDN.
    
    To disable them, set their URLs to `None` when creating your `FastAPI` app:
    
    {* ../../docs_src/custom_docs_ui/tutorial001.py hl[8] *}
    
    ### Include the custom docs
    
    Now you can create the *path operations* for the custom docs.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Mon Oct 28 10:42:34 UTC 2024
    - 7.3K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_websockets/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    from fastapi.websockets import WebSocketDisconnect
    
    from docs_src.websockets.tutorial001 import app
    
    client = TestClient(app)
    
    
    def test_main():
        response = client.get("/")
        assert response.status_code == 200, response.text
        assert b"<!DOCTYPE html>" in response.content
    
    
    def test_websocket():
        with pytest.raises(WebSocketDisconnect):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 10 09:08:19 UTC 2020
    - 822 bytes
    - Viewed (0)
  4. docs/zh/docs/advanced/custom-response.md

    ///
    
    ```Python hl_lines="2 7"
    {!../../docs_src/custom_response/tutorial001.py!}
    ```
    
    /// tip | "小贴士"
    
    `ORJSONResponse` 可能是一个更快的选择。
    
    ///
    
    ### `RedirectResponse`
    
    返回 HTTP 重定向。默认情况下使用 307 状态代码(临时重定向)。
    
    ```Python hl_lines="2  9"
    {!../../docs_src/custom_response/tutorial006.py!}
    ```
    
    ### `StreamingResponse`
    
    采用异步生成器或普通生成器/迭代器,然后流式传输响应主体。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_first_steps/test_tutorial001.py

    import pytest
    from fastapi.testclient import TestClient
    
    from docs_src.first_steps.tutorial001 import app
    
    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/", 200, {"message": "Hello World"}),
            ("/nonexistent", 404, {"detail": "Not Found"}),
        ],
    )
    def test_get_path(path, expected_status, expected_response):
        response = client.get(path)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 1.2K bytes
    - Viewed (0)
  6. docs/pt/docs/advanced/behind-a-proxy.md

    Nesse caso, o caminho original `/app` seria servido em `/api/v1/app`.
    
    Embora todo o seu código esteja escrito assumindo que existe apenas `/app`.
    
    {* ../../docs_src/behind_a_proxy/tutorial001.py hl[6] *}
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 15:28:18 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  7. docs/em/docs/advanced/openapi-callbacks.md

    {!../../docs_src/openapi_callbacks/tutorial001.py!}
    ```
    
    ### ✍ ⏲ *➡ 🛠️*
    
    ✍ ⏲ *➡ 🛠️* ⚙️ 🎏 `APIRouter` 👆 ✍ 🔛.
    
    ⚫️ 🔜 👀 💖 😐 FastAPI *➡ 🛠️*:
    
    * ⚫️ 🔜 🎲 ✔️ 📄 💪 ⚫️ 🔜 📨, ✅ `body: InvoiceEvent`.
    *  &amp; ⚫️ 💪 ✔️ 📄 📨 ⚫️ 🔜 📨, ✅ `response_model=InvoiceEventReceived`.
    
    ```Python hl_lines="16-18  21-22  28-32"
    {!../../docs_src/openapi_callbacks/tutorial001.py!}
    ```
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 6.6K bytes
    - Viewed (0)
  8. docs/ko/docs/python-types.md

    간단한 예제부터 시작해봅시다:
    
    ```Python
    {!../../docs_src/python_types/tutorial001.py!}
    ```
    
    이 프로그램을 실행한 결과값:
    
    ```
    John Doe
    ```
    
    함수는 아래와 같이 실행됩니다:
    
    * `first_name`과 `last_name`를 받습니다.
    * `title()`로 각 첫 문자를 대문자로 변환시킵니다.
    * 두 단어를 중간에 공백을 두고 <abbr title="두 개를 하나로 차례차례 이어지게 하다">연결</abbr>합니다.
    
    ```Python hl_lines="2"
    {!../../docs_src/python_types/tutorial001.py!}
    ```
    
    ### 코드 수정
    
    이건 매우 간단한 프로그램입니다.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10.5K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/response-status-code.md

    Schauen wir uns das vorherige Beispiel noch einmal an:
    
    {* ../../docs_src/response_status_code/tutorial001.py hl[6] *}
    
    `201` ist der Statuscode für „Created“ („Erzeugt“).
    
    Aber Sie müssen sich nicht daran erinnern, welcher dieser Codes was bedeutet.
    
    Sie können die Hilfsvariablen von `fastapi.status` verwenden.
    
    {* ../../docs_src/response_status_code/tutorial002.py hl[1,6] *}
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 16:59:43 UTC 2024
    - 4.6K bytes
    - Viewed (0)
  10. docs/ru/docs/tutorial/response-status-code.md

    ```Python hl_lines="6"
    {!../../docs_src/response_status_code/tutorial001.py!}
    ```
    
    `201` – это код статуса "Создано".
    
    Но вам не обязательно запоминать, что означает каждый из этих кодов.
    
    Для удобства вы можете использовать переменные из `fastapi.status`.
    
    ```Python hl_lines="1  6"
    {!../../docs_src/response_status_code/tutorial002.py!}
    ```
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 7K bytes
    - Viewed (0)
Back to top