Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 7551 - 7560 of 7,804 for RETURN (0.32 seconds)

  1. docs_src/path_operation_advanced_configuration/tutorial007_py310.py

        try:
            item = Item.model_validate(data)
        except ValidationError as e:
            raise HTTPException(status_code=422, detail=e.errors(include_url=False))
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 797 bytes
    - Click Count (0)
  2. docs_src/query_params_str_validations/tutorial009_py310.py

    
    @app.get("/items/")
    async def read_items(q: str | None = Query(default=None, alias="item-query")):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 281 bytes
    - Click Count (0)
  3. tests/test_tutorial/test_authentication_error_status_code/test_tutorial001.py

        ],
    )
    def get_client(request: pytest.FixtureRequest):
        mod = importlib.import_module(
            f"docs_src.authentication_error_status_code.{request.param}"
        )
    
        client = TestClient(mod.app)
        return client
    
    
    def test_get_me(client: TestClient):
        response = client.get("/me", headers={"Authorization": "Bearer secrettoken"})
        assert response.status_code == 200
        assert response.json() == {
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 1.9K bytes
    - Click Count (0)
  4. docs/pt/docs/tutorial/stream-json-lines.md

    ///
    
    ## Stream de JSON Lines com FastAPI { #stream-json-lines-with-fastapi }
    
    Para transmitir JSON Lines com FastAPI, em vez de usar `return` na sua *função de operação de rota*, use `yield` para produzir cada item em sequência.
    
    {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[24] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:13 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  5. tests/test_return_none_stringified_annotations.py

    from fastapi.testclient import TestClient
    
    
    def test_no_content():
        app = FastAPI()
    
        @app.get("/no-content", status_code=http.HTTPStatus.NO_CONTENT)
        def return_no_content() -> "None":
            return
    
        client = TestClient(app)
        response = client.get("/no-content")
        assert response.status_code == http.HTTPStatus.NO_CONTENT, response.text
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Sep 20 18:44:43 GMT 2025
    - 431 bytes
    - Click Count (0)
  6. docs/es/docs/tutorial/stream-json-lines.md

    ///
    
    ## Transmitir JSON Lines con FastAPI { #stream-json-lines-with-fastapi }
    
    Para transmitir JSON Lines con FastAPI puedes, en lugar de usar `return` en tu *path operation function*, usar `yield` para producir cada ítem a su turno.
    
    {* ../../docs_src/stream_json_lines/tutorial001_py310.py ln[1:24] hl[24] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:12:26 GMT 2026
    - 4.6K bytes
    - Click Count (0)
  7. docs/fr/docs/advanced/response-directly.md

    # Renvoyer directement une réponse { #return-a-response-directly }
    
    Lorsque vous créez un *chemin d'accès* **FastAPI**, vous pouvez normalement renvoyer n'importe quelle donnée : un `dict`, une `list`, un modèle Pydantic, un modèle de base de données, etc.
    
    Si vous déclarez un [Modèle de réponse](../tutorial/response-model.md), FastAPI l'utilise pour sérialiser les données en JSON, en utilisant Pydantic.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:37:13 GMT 2026
    - 4.8K bytes
    - Click Count (0)
  8. docs/zh/docs/tutorial/dependencies/sub-dependencies.md

    async def needy_dependency(fresh_value: Annotated[str, Depends(get_value, use_cache=False)]):
        return {"fresh_value": fresh_value}
    ```
    
    ////
    
    //// tab | Python 3.10+ 非 Annotated
    
    /// tip | 提示
    
    尽可能优先使用 `Annotated` 版本。
    
    ///
    
    ```Python hl_lines="1"
    async def needy_dependency(fresh_value: str = Depends(get_value, use_cache=False)):
        return {"fresh_value": fresh_value}
    ```
    
    ////
    
    ## 小结 { #recap }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Feb 13 13:37:57 GMT 2026
    - 3.8K bytes
    - Click Count (0)
  9. tests/test_additional_response_extra.py

    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    router = APIRouter()
    
    sub_router = APIRouter()
    
    app = FastAPI()
    
    
    @sub_router.get("/")
    def read_item():
        return {"id": "foo"}
    
    
    router.include_router(sub_router, prefix="/items")
    
    app.include_router(router)
    
    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.get("/items/")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 1.3K bytes
    - Click Count (0)
  10. tests/test_deprecated_openapi_prefix.py

    from fastapi import FastAPI, Request
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI(openapi_prefix="/api/v1")
    
    
    @app.get("/app")
    def read_main(request: Request):
        return {"message": "Hello World", "root_path": request.scope.get("root_path")}
    
    
    client = TestClient(app)
    
    
    def test_main():
        response = client.get("/app")
        assert response.status_code == 200
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 1.3K bytes
    - Click Count (0)
Back to Top