Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 362 for stats (0.14 sec)

  1. docs/en/docs/reference/status.md

    # Status Codes
    
    You can import the `status` module from `fastapi`:
    
    ```python
    from fastapi import status
    ```
    
    `status` is provided directly by Starlette.
    
    It contains a group of named constants (variables) with integer status codes.
    
    For example:
    
    * 200: `status.HTTP_200_OK`
    * 403: `status.HTTP_403_FORBIDDEN`
    * etc.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 871 bytes
    - Viewed (0)
  2. docs/de/docs/reference/status.md

    # Statuscodes
    
    Sie können das Modul `status` von `fastapi` importieren:
    
    ```python
    from fastapi import status
    ```
    
    `status` wird direkt von Starlette bereitgestellt.
    
    Es enthält eine Gruppe benannter Konstanten (Variablen) mit ganzzahligen Statuscodes.
    
    Zum Beispiel:
    
    * 200: `status.HTTP_200_OK`
    * 403: `status.HTTP_403_FORBIDDEN`
    * usw.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 18:17:17 GMT 2024
    - 934 bytes
    - Viewed (0)
  3. docs/en/docs/advanced/additional-status-codes.md

    # Additional Status Codes
    
    By default, **FastAPI** will return the responses using a `JSONResponse`, putting the content you return from your *path operation* inside of that `JSONResponse`.
    
    It will use the default status code or the one you set in your *path operation*.
    
    ## Additional status codes
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  4. docs/ko/docs/tutorial/response-status-code.md

    {!../../../docs_src/response_status_code/tutorial002.py!}
    ```
    
    이것은 단순히 작업을 편리하게 하기 위한 것으로, HTTP 상태 코드와 동일한 번호를 갖고있지만, 이를 사용하면 편집기의 자동완성 기능을 사용할 수 있습니다:
    
    <img src="https://fastapi.tiangolo.com/img/tutorial/response-status-code/image02.png">
    
    !!! note "기술적 세부사항"
        `from starlette import status` 역시 사용할 수 있습니다.
    
        **FastAPI**는 개발자인 당신의 편의를 위해 `fastapi.status` 와 동일한 `starlette.status` 도 제공합니다. 하지만 이것은 Starlette로부터 직접 제공됩니다.
    
    ## 기본값 변경
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 4.8K bytes
    - Viewed (0)
  5. docs/en/docs/advanced/response-change-status-code.md

    # Response - Change Status Code
    
    You probably read before that you can set a default [Response Status Code](../tutorial/response-status-code.md){.internal-link target=_blank}.
    
    But in some cases you need to return a different status code than the default.
    
    ## Use case
    
    For example, imagine that you want to return an HTTP status code of "OK" `200` by default.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 1.5K bytes
    - Viewed (0)
  6. docs/es/docs/advanced/response-change-status-code.md

    # Response - Cambiar el Status Code
    
    Probablemente ya has leído con anterioridad que puedes establecer un [Response Status Code](../tutorial/response-status-code.md){.internal-link target=_blank} por defecto.
    
    Pero en algunos casos necesitas retornar un status code diferente al predeterminado.
    
    ## Casos de uso
    
    Por ejemplo, imagina que quieres retornar un HTTP status code de "OK" `200` por defecto.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Feb 06 19:56:23 GMT 2024
    - 1.6K bytes
    - Viewed (0)
  7. docs/de/docs/advanced/response-change-status-code.md

    Anschließend können Sie den `status_code` in diesem *vorübergehenden* Response-Objekt festlegen.
    
    ```Python hl_lines="1  9  12"
    {!../../../docs_src/response_change_status_code/tutorial001.py!}
    ```
    
    Und dann können Sie wie gewohnt jedes benötigte Objekt zurückgeben (ein `dict`, ein Datenbankmodell usw.).
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:18:58 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  8. tests/test_dependency_normal_exceptions.py

    
    client = TestClient(app)
    
    
    def test_dependency_gets_exception():
        assert state["except"] is False
        assert state["finally"] is False
        response = client.put("/invalid-user/rick", json="Morty")
        assert response.status_code == 400, response.text
        assert response.json() == {"detail": "Invalid user"}
        assert state["except"] is True
        assert state["finally"] is True
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  9. tests/test_router_events.py

        app.include_router(router)
    
        assert state.app_startup is False
        assert state.router_startup is False
        assert state.sub_router_startup is False
        assert state.app_shutdown is False
        assert state.router_shutdown is False
        assert state.sub_router_shutdown is False
        with TestClient(app) as client:
            assert state.app_startup is True
            assert state.router_startup is True
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Wed Oct 18 12:36:40 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  10. docs_src/sql_databases/sql_app_py310/alt_main.py

        response = Response("Internal server error", status_code=500)
        try:
            request.state.db = SessionLocal()
            response = await call_next(request)
        finally:
            request.state.db.close()
        return response
    
    
    # Dependency
    def get_db(request: Request):
        return request.state.db
    
    
    @app.post("/users/", response_model=schemas.User)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.9K bytes
    - Viewed (0)
Back to top