- Sort Score
- Result 10 results
- Languages All
Results 471 - 480 of 907 for fdef (0.02 sec)
-
tests/test_tutorial/test_custom_response/test_tutorial004.py
</head> <body> <h1>Look ma! HTML!</h1> </body> </html> """ def test_get_custom_response(): response = client.get("/items/") assert response.status_code == 200, response.text assert response.text == html_contents def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.2K bytes - Viewed (0) -
docs_src/response_model/tutorial005.py
} @app.get( "/items/{item_id}/name", response_model=Item, response_model_include={"name", "description"}, ) async def read_item_name(item_id: str): return items[item_id] @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude={"tax"}) async def read_item_public_data(item_id: str):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 848 bytes - Viewed (0) -
docs_src/response_model/tutorial006.py
} @app.get( "/items/{item_id}/name", response_model=Item, response_model_include=["name", "description"], ) async def read_item_name(item_id: str): return items[item_id] @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"]) async def read_item_public_data(item_id: str):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 848 bytes - Viewed (0) -
docs_src/security/tutorial007_an_py39.py
import secrets from typing import Annotated from fastapi import Depends, FastAPI, HTTPException, status from fastapi.security import HTTPBasic, HTTPBasicCredentials app = FastAPI() security = HTTPBasic() def get_current_username( credentials: Annotated[HTTPBasicCredentials, Depends(security)], ): current_username_bytes = credentials.username.encode("utf8") correct_username_bytes = b"stanleyjobson"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Mar 26 16:56:53 UTC 2024 - 1.1K bytes - Viewed (0) -
docs/en/docs/index.md
app = FastAPI() @app.get("/") def read_root(): return {"Hello": "World"} @app.get("/items/{item_id}") def read_item(item_id: int, q: Union[str, None] = None): return {"item_id": item_id, "q": q} ``` <details markdown="1"> <summary>Or use <code>async def</code>...</summary> If your code uses `async` / `await`, use `async def`: ```Python hl_lines="9 14"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 20 19:20:23 UTC 2024 - 20.4K bytes - Viewed (0) -
tests/test_tutorial/test_async_tests/test_main.py
import pytest from docs_src.async_tests.test_main import test_root @pytest.mark.anyio async def test_async_testing():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 06 15:32:11 UTC 2021 - 143 bytes - Viewed (0) -
docs_src/path_operation_advanced_configuration/tutorial001.py
from fastapi import FastAPI app = FastAPI() @app.get("/items/", operation_id="some_specific_id_you_define") async def read_items():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 167 bytes - Viewed (0) -
tests/test_include_router_defaults_overrides.py
async def dep0(response: Response): response.headers["x-level0"] = "True" async def dep1(response: Response): response.headers["x-level1"] = "True" async def dep2(response: Response): response.headers["x-level2"] = "True" async def dep3(response: Response): response.headers["x-level3"] = "True" async def dep4(response: Response):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 358.6K bytes - Viewed (0) -
docs/pt/docs/tutorial/background-tasks.md
É apenas uma função padrão que pode receber parâmetros. Pode ser uma função `async def` ou `def` normal, o **FastAPI** saberá como lidar com isso corretamente. Nesse caso, a função de tarefa gravará em um arquivo (simulando o envio de um e-mail). E como a operação de gravação não usa `async` e `await`, definimos a função com `def` normal: ```Python hl_lines="6-9" {!../../docs_src/background_tasks/tutorial001.py!} ```
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 5.3K bytes - Viewed (0) -
docs/en/docs/tutorial/background-tasks.md
It is just a standard function that can receive parameters. It can be an `async def` or normal `def` function, **FastAPI** will know how to handle it correctly. In this case, the task function will write to a file (simulating sending an email). And as the write operation doesn't use `async` and `await`, we define the function with normal `def`: {* ../../docs_src/background_tasks/tutorial001.py hl[6:9] *} ## Add the background task
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 27 15:22:48 UTC 2024 - 4.8K bytes - Viewed (0)