- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 334 for json (0.15 sec)
-
docs/ja/docs/advanced/response-directly.md
# レスポンスを直接返す **FastAPI** の *path operation* では、通常は任意のデータを返すことができます: 例えば、 `dict`、`list`、Pydanticモデル、データベースモデルなどです。 デフォルトでは、**FastAPI** は [JSON互換エンコーダ](../tutorial/encoder.md){.internal-link target=_blank} で説明されている `jsonable_encoder` により、返す値を自動的にJSONに変換します。 このとき背後では、JSON互換なデータ (例えば`dict`) を、クライアントへ送信されるレスポンスとして利用される `JSONResponse` の中に含めます。 しかし、*path operation* から `JSONResponse` を直接返すこともできます。 これは例えば、カスタムヘッダーやcookieを返すときに便利です。 ## `Response` を返す
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Nov 05 22:50:38 GMT 2020 - 3.6K bytes - Viewed (0) -
docs/zh/docs/index.md
* 因为 `q` 被声明为 `= None`,所以它是可选的。 * 如果没有 `None` 它将会是必需的 (如 `PUT` 例子中的请求体)。 * 对于访问 `/items/{item_id}` 的 `PUT` 请求,将请求体读取为 JSON 并: * 检查是否有必需属性 `name` 并且值为 `str` 类型 。 * 检查是否有必需属性 `price` 并且值为 `float` 类型。 * 检查是否有可选属性 `is_offer`, 如果有的话值应该为 `bool` 类型。 * 以上过程对于多层嵌套的 JSON 对象同样也会执行 * 自动对 JSON 进行转换或转换成 JSON。 * 通过 OpenAPI 文档来记录所有内容,可被用于: * 交互式文档系统 * 许多编程语言的客户端代码自动生成系统 * 直接提供 2 种交互式文档 web 界面。 ---
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Apr 29 05:18:04 GMT 2024 - 18.2K bytes - Viewed (0) -
docs/en/docs/tutorial/testing.md
Then you just do the same in your tests. E.g.: * To pass a *path* or *query* parameter, add it to the URL itself. * To pass a JSON body, pass a Python object (e.g. a `dict`) to the parameter `json`. * If you need to send *Form Data* instead of JSON, use the `data` parameter instead. * To pass *headers*, use a `dict` in the `headers` parameter. * For *cookies*, a `dict` in the `cookies` parameter.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 6.2K bytes - Viewed (0) -
docs/en/docs/tutorial/path-params.md
You can return *enum members* from your *path operation*, even nested in a JSON body (e.g. a `dict`). They will be converted to their corresponding values (strings in this case) before returning them to the client: ```Python hl_lines="18 21 23" {!../../../docs_src/path_params/tutorial005.py!} ``` In your client you will get a JSON response like: ```JSON { "model_name": "alexnet", "message": "Deep Learning FTW!"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.1K bytes - Viewed (0) -
docs/ru/docs/tutorial/path-params.md
Из *операции пути* можно вернуть *элементы перечисления*, даже вложенные в тело JSON (например в `dict`). Они будут преобразованы в соответствующие значения (в данном случае - строки) перед их возвратом клиенту: ```Python hl_lines="18 21 23" {!../../../docs_src/path_params/tutorial005.py!} ``` Вы отправите клиенту такой JSON-ответ: ```JSON { "model_name": "alexnet", "message": "Deep Learning FTW!" } ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 14.1K bytes - Viewed (0) -
docs/zh/docs/tutorial/path-params.md
``` !!! tip "提示" 使用 `ModelName.lenet.value` 也能获取值 `"lenet"`。 #### 返回*枚举元素* 即使嵌套在 JSON 请求体里(例如, `dict`),也可以从*路径操作*返回*枚举元素*。 返回给客户端之前,要把枚举元素转换为对应的值(本例中为字符串): ```Python hl_lines="18 21 23" {!../../../docs_src/path_params/tutorial005.py!} ``` 客户端中的 JSON 响应如下: ```JSON { "model_name": "alexnet", "message": "Deep Learning FTW!" } ``` ## 包含路径的路径参数
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Apr 01 05:35:40 GMT 2024 - 7.6K bytes - Viewed (0) -
docs/en/docs/alternatives.md
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 23.2K bytes - Viewed (0) -
docs/zh/docs/tutorial/response-model.md
举个例子,当你在 NoSQL 数据库中保存了具有许多可选属性的模型,但你又不想发送充满默认值的很长的 JSON 响应。 ### 使用 `response_model_exclude_unset` 参数 你可以设置*路径操作装饰器*的 `response_model_exclude_unset=True` 参数: ```Python hl_lines="24" {!../../../docs_src/response_model/tutorial004.py!} ``` 然后响应中将不会包含那些默认值,而是仅有实际设置的值。 因此,如果你向*路径操作*发送 ID 为 `foo` 的商品的请求,则响应(不包括默认值)将为: ```JSON { "name": "Foo", "price": 50.2 } ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 7.9K bytes - Viewed (0) -
docs/em/docs/tutorial/handling-errors.md
🚥 👩💻 📨 `http://example.com/items/foo` ( `item_id` `"foo"`), 👈 👩💻 🔜 📨 🇺🇸🔍 👔 📟 2️⃣0️⃣0️⃣, & 🎻 📨: ```JSON { "item": "The Foo Wrestlers" } ``` ✋️ 🚥 👩💻 📨 `http://example.com/items/bar` (🚫-🚫 `item_id` `"bar"`), 👈 👩💻 🔜 📨 🇺🇸🔍 👔 📟 4️⃣0️⃣4️⃣ ("🚫 🔎" ❌), & 🎻 📨: ```JSON { "detail": "Item not found" } ``` !!! tip
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 8.3K bytes - Viewed (0) -
docs/ko/docs/tutorial/request-files.md
**FastAPI**의 `UploadFile` 은 **Starlette**의 `UploadFile` 을 직접적으로 상속받지만, **Pydantic** 및 FastAPI의 다른 부분들과의 호환성을 위해 필요한 부분들이 추가되었습니다. ## "폼 데이터"란 HTML의 폼들(`<form></form>`)이 서버에 데이터를 전송하는 방식은 대개 데이터에 JSON과는 다른 "특별한" 인코딩을 사용합니다. **FastAPI**는 JSON 대신 올바른 위치에서 데이터를 읽을 수 있도록 합니다. !!! note "기술적 세부사항" 폼의 데이터는 파일이 포함되지 않은 경우 일반적으로 "미디어 유형" `application/x-www-form-urlencoded` 을 사용해 인코딩 됩니다.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 8.1K bytes - Viewed (0)