- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 156 for 404 (0.13 sec)
-
docs_src/bigger_applications/app_an_py39/routers/items.py
responses={404: {"description": "Not found"}}, ) fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}} @router.get("/") async def read_items(): return fake_items_db @router.get("/{item_id}") async def read_item(item_id: str): if item_id not in fake_items_db: raise HTTPException(status_code=404, detail="Item not found")
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 1011 bytes - Viewed (0) -
docs/de/docs/advanced/additional-responses.md
**FastAPI** nimmt dieses Modell, generiert dessen JSON-Schema und fügt es an der richtigen Stelle in OpenAPI ein. Um beispielsweise eine weitere Response mit dem Statuscode `404` und einem Pydantic-Modell `Message` zu deklarieren, können Sie schreiben: ```Python hl_lines="18 22" {!../../../docs_src/additional_responses/tutorial001.py!} ``` !!! note "Hinweis"
Plain Text - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 20:19:26 GMT 2024 - 9.6K bytes - Viewed (0) -
docs/en/docs/advanced/additional-responses.md
**FastAPI** will take that model, generate its JSON Schema and include it in the correct place in OpenAPI. For example, to declare another response with a status code `404` and a Pydantic model `Message`, you can write: ```Python hl_lines="18 22" {!../../../docs_src/additional_responses/tutorial001.py!} ``` !!! note Keep in mind that you have to return the `JSONResponse` directly.
Plain Text - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 8.8K bytes - Viewed (0) -
docs/ru/docs/tutorial/handling-errors.md
Они похожи на двухсотые HTTP статус-коды (от 200 до 299), которые означают, что запрос обработан успешно. Четырёхсотые статус-коды означают, что ошибка произошла по вине клиента. Помните ли ошибки **"404 Not Found "** (и шутки) ? ## Использование `HTTPException` Для возврата клиенту HTTP-ответов с ошибками используется `HTTPException`. ### Импортируйте `HTTPException` ```Python hl_lines="1"
Plain Text - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 14.5K bytes - Viewed (0) -
docs_src/handling_errors/tutorial002.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"}, )
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Thu Mar 26 19:09:53 GMT 2020 - 404 bytes - Viewed (0) -
docs_src/dependencies/tutorial008c_an.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" )
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 710 bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial008b_an.py
from fastapi.testclient import TestClient from docs_src.dependencies.tutorial008b_an import app client = TestClient(app) def test_get_no_item(): response = client.get("/items/foo") assert response.status_code == 404, response.text assert response.json() == {"detail": "Item not found"} def test_owner_error(): response = client.get("/items/plumbus") assert response.status_code == 400, response.text
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Tue Dec 26 20:37:34 GMT 2023 - 700 bytes - Viewed (0) -
docs_src/dependencies/tutorial008b.py
@app.get("/items/{item_id}") def get_item(item_id: str, username: str = Depends(get_username)): if item_id not in data: raise HTTPException(status_code=404, detail="Item not found") item = data[item_id] if item["owner"] != username: raise OwnerError(username)
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Tue Dec 26 20:37:34 GMT 2023 - 735 bytes - Viewed (0) -
docs_src/dependencies/tutorial008b_an.py
@app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]): if item_id not in data: raise HTTPException(status_code=404, detail="Item not found") item = data[item_id] if item["owner"] != username: raise OwnerError(username)
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Tue Dec 26 20:37:34 GMT 2023 - 785 bytes - Viewed (0) -
docs_src/dependencies/tutorial008c_an_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" )
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 700 bytes - Viewed (0)