- Sort Score
- Result 10 results
- Languages All
Results 81 - 90 of 106 for 404 (0.12 sec)
-
docs_src/app_testing/app_b_an_py310/test_main.py
assert response.json() == {"detail": "Invalid X-Token header"} def test_read_nonexistent_item(): response = client.get("/items/baz", headers={"X-Token": "coneofsilence"}) assert response.status_code == 404 assert response.json() == {"detail": "Item not found"} def test_create_item(): response = client.post( "/items/", headers={"X-Token": "coneofsilence"},
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Mar 13 19:07:10 GMT 2024 - 1.8K bytes - Viewed (0) -
docs_src/sql_databases/sql_app_py310/alt_main.py
@app.get("/users/{user_id}", response_model=schemas.User) def read_user(user_id: int, db: Session = Depends(get_db)): db_user = crud.get_user(db, user_id=user_id) if db_user is None: raise HTTPException(status_code=404, detail="User not found") return db_user @app.post("/users/{user_id}/items/", response_model=schemas.Item) def create_item_for_user( user_id: int, item: schemas.ItemCreate, db: Session = Depends(get_db) ):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 1.9K bytes - Viewed (0) -
docs/en/docs/tutorial/bigger-applications.md
``` !!! tip This last path operation will have the combination of tags: `["items", "custom"]`. And it will also have both responses in the documentation, one for `404` and one for `403`. ## The main `FastAPI` Now, let's see the module at `app/main.py`. Here's where you import and use the class `FastAPI`.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 18.6K bytes - Viewed (0) -
docs_src/sql_databases/sql_app/alt_main.py
@app.get("/users/{user_id}", response_model=schemas.User) def read_user(user_id: int, db: Session = Depends(get_db)): db_user = crud.get_user(db, user_id=user_id) if db_user is None: raise HTTPException(status_code=404, detail="User not found") return db_user @app.post("/users/{user_id}/items/", response_model=schemas.Item) def create_item_for_user( user_id: int, item: schemas.ItemCreate, db: Session = Depends(get_db) ):
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Mar 26 19:09:53 GMT 2020 - 1.9K bytes - Viewed (0) -
docs/en/docs/tutorial/path-operation-configuration.md
## Response Status Code You can define the (HTTP) `status_code` to be used in the response of your *path operation*. You can pass directly the `int` code, like `404`. But if you don't remember what each number code is for, you can use the shortcut constants in `status`: === "Python 3.10+" ```Python hl_lines="1 15"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 17 05:59:11 GMT 2023 - 5.5K bytes - Viewed (0) -
docs/ja/docs/tutorial/path-operation-configuration.md
*path operationデコレータ*を設定するためのパラメータがいくつかあります。 !!! warning "注意" これらのパラメータは*path operation関数*ではなく、*path operationデコレータ*に直接渡されることに注意してください。 ## レスポンスステータスコード *path operation*のレスポンスで使用する(HTTP)`status_code`を定義することができます。 `404`のように`int`のコードを直接渡すことができます。 しかし、それぞれの番号コードが何のためのものか覚えていない場合は、`status`のショートカット定数を使用することができます: ```Python hl_lines="3 17" {!../../../docs_src/path_operation_configuration/tutorial001.py!} ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 02 04:38:26 GMT 2024 - 4.3K bytes - Viewed (0) -
docs/ja/docs/how-to/conditional-openapi.md
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Aug 19 19:54:04 GMT 2023 - 3.1K bytes - Viewed (0) -
docs/ru/docs/tutorial/response-status-code.md
* **`4XX`** – статус-коды, сообщающие о клиентской ошибке. Это ещё одна наиболее часто используемая категория. * Пример – код `404` для статуса "Not Found". * Для общих ошибок со стороны клиента можно просто использовать код `400`.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 25 18:44:34 GMT 2023 - 7K bytes - Viewed (0) -
docs/zh/docs/tutorial/path-operation-configuration.md
# 路径操作配置 *路径操作装饰器*支持多种配置参数。 !!! warning "警告" 注意:以下参数应直接传递给**路径操作装饰器**,不能传递给*路径操作函数*。 ## `status_code` 状态码 `status_code` 用于定义*路径操作*响应中的 HTTP 状态码。 可以直接传递 `int` 代码, 比如 `404`。 如果记不住数字码的涵义,也可以用 `status` 的快捷常量: ```Python hl_lines="3 17" {!../../../docs_src/path_operation_configuration/tutorial001.py!} ``` 状态码在响应中使用,并会被添加到 OpenAPI 概图。 !!! note "技术细节"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu May 12 00:06:16 GMT 2022 - 3.4K bytes - Viewed (0) -
docs/zh/docs/tutorial/bigger-applications.md
```Python hl_lines="30-31" title="app/routers/items.py" {!../../../docs_src/bigger_applications/app/routers/items.py!} ``` !!! tip 最后的这个路径操作将包含标签的组合:`["items","custom"]`。 并且在文档中也会有两个响应,一个用于 `404`,一个用于 `403`。 ## `FastAPI` 主体 现在,让我们来看看位于 `app/main.py` 的模块。 在这里你导入并使用 `FastAPI` 类。 这将是你的应用程序中将所有内容联结在一起的主文件。 并且由于你的大部分逻辑现在都存在于其自己的特定模块中,因此主文件的内容将非常简单。 ### 导入 `FastAPI`
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 18.5K bytes - Viewed (0)