- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 35 for 4094 (0.02 sec)
-
tests/test_generate_unique_id_function.py
router = APIRouter() @app.post("/", response_model=list[Item], responses={404: {"model": list[Message]}}) def post_root(item1: Item, item2: Item): return item1, item2 # pragma: nocover @router.post( "/router", response_model=list[Item], responses={404: {"model": list[Message]}} ) def post_router(item1: Item, item2: Item):
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 66.7K bytes - Viewed (0) -
docs_src/additional_responses/tutorial003_py39.py
id: str value: str class Message(BaseModel): message: str app = FastAPI() @app.get( "/items/{item_id}", response_model=Item, responses={ 404: {"model": Message, "description": "The item was not found"}, 200: { "description": "Item requested by ID", "content": { "application/json": {Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 837 bytes - Viewed (0) -
tests/test_tutorial/test_bigger_applications/test_main.py
def test_items_bar_token_jessica(client: TestClient): response = client.get( "/items/bar?token=jessica", headers={"X-Token": "fake-super-secret-token"} ) assert response.status_code == 404 assert response.json() == {"detail": "Item not found"} def test_items_plumbus_with_no_token(client: TestClient): response = client.get(
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Dec 27 18:19:10 UTC 2025 - 21.3K bytes - Viewed (0) -
docs/pt/docs/advanced/additional-responses.md
O **FastAPI** pegará este modelo, gerará o esquema JSON dele e incluirá no local correto do OpenAPI. Por exemplo, para declarar um outro retorno com o status code `404` e um modelo do Pydantic chamado `Message`, você pode escrever: {* ../../docs_src/additional_responses/tutorial001_py39.py hl[18,22] *} /// note | Nota Lembre-se que você deve retornar o `JSONResponse` diretamente.Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 9.4K bytes - Viewed (0) -
docs/ru/docs/advanced/additional-responses.md
**FastAPI** возьмёт эту модель, сгенерирует для неё JSON‑схему и включит её в нужное место в OpenAPI. Например, чтобы объявить ещё один ответ со статус-кодом `404` и Pydantic-моделью `Message`, можно написать: {* ../../docs_src/additional_responses/tutorial001_py39.py hl[18,22] *} /// note | Примечание Имейте в виду, что необходимо возвращать `JSONResponse` напрямую. ///Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 12.3K bytes - Viewed (0) -
docs_src/handling_errors/tutorial001_py39.py
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 299 bytes - Viewed (0) -
docs_src/handling_errors/tutorial002_py39.py
app = FastAPI() items = {"foo": "The Foo Wrestlers"} @app.get("/items-header/{item_id}") async def read_item_header(item_id: str): if item_id not in items: raise HTTPException( status_code=404, detail="Item not found", headers={"X-Error": "There goes my error"}, )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 404 bytes - Viewed (0) -
docs_src/dependencies/tutorial008c_py39.py
raise InternalError( f"The portal gun is too dangerous to be owned by {username}" ) if item_id != "plumbus": raise HTTPException( status_code=404, detail="Item not found, there's only a plumbus here" )
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 660 bytes - Viewed (0) -
docs_src/additional_responses/tutorial004_py310.py
from fastapi import FastAPI from fastapi.responses import FileResponse from pydantic import BaseModel class Item(BaseModel): id: str value: str responses = { 404: {"description": "Item not found"}, 302: {"description": "The item was moved"}, 403: {"description": "Not enough privileges"}, } app = FastAPI() @app.get( "/items/{item_id}", response_model=Item,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 10 08:55:32 UTC 2025 - 669 bytes - Viewed (0) -
tests/test_tutorial/test_metadata/test_tutorial002.py
assert response.status_code == 200, response.text assert response.json() == [{"name": "Foo"}] def test_get_openapi_json_default_url(): response = client.get("/openapi.json") assert response.status_code == 404, response.text def test_openapi_schema(): response = client.get("/api/v1/openapi.json") assert response.status_code == 200, response.text assert response.json() == { "openapi": "3.1.0",Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Dec 26 10:43:02 UTC 2025 - 1.2K bytes - Viewed (0)