- Sort Score
- Result 10 results
- Languages All
Results 41 - 50 of 214 for body (0.18 sec)
-
docs_src/path_operation_advanced_configuration/tutorial007.py
"content": {"application/x-yaml": {"schema": Item.model_json_schema()}}, "required": True, }, }, ) async def create_item(request: Request): raw_body = await request.body() try: data = yaml.safe_load(raw_body) except yaml.YAMLError: raise HTTPException(status_code=422, detail="Invalid YAML") try: item = Item.model_validate(data) except ValidationError as e:
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 822 bytes - Viewed (0) -
tests/test_tutorial/test_extra_data_types/test_tutorial001.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Apr 19 00:11:40 GMT 2024 - 6.8K bytes - Viewed (0) -
tests/test_tutorial/test_handling_errors/test_tutorial005.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 4.3K bytes - Viewed (0) -
docs/zh/docs/advanced/custom-request-and-route.md
如此一来,`GzipRequest` 把数据传递给*路径操作*前,就会解压数据(如需)。 之后,所有处理逻辑都一样。 但因为改变了 `GzipRequest.body`,**FastAPI** 加载请求体时会自动解压。 ## 在异常处理器中访问请求体 !!! tip "提示" 为了解决同样的问题,在 `RequestValidationError` 的自定义处理器使用 `body` ([处理错误](../tutorial/handling-errors.md#use-the-requestvalidationerror-body){.internal-link target=_blank})可能会更容易。 但本例仍然可行,而且本例展示了如何与内部组件进行交互。 同样也可以在异常处理器中访问请求体。
Plain Text - Registered: Sun Mar 31 07:19:09 GMT 2024 - Last Modified: Sat Mar 30 22:45:40 GMT 2024 - 3.8K bytes - Viewed (0) -
docs/ja/docs/tutorial/request-forms.md
``` ## `Form`のパラメータの定義 `Body`や`Query`の場合と同じようにフォームパラメータを作成します: ```Python hl_lines="7" {!../../../docs_src/request_forms/tutorial001.py!} ``` 例えば、OAuth2仕様が使用できる方法の1つ(「パスワードフロー」と呼ばれる)では、フォームフィールドとして`username`と`password`を送信する必要があります。 <abbr title="仕様">仕様</abbr>では、フィールドの名前が`username`と`password`であることと、JSONではなくフォームフィールドとして送信されることを要求しています。 `Form`では`Body`(および`Query`や`Path`、`Cookie`)と同じメタデータとバリデーションを宣言することができます。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 3.3K bytes - Viewed (0) -
docs/ru/docs/tutorial/request-forms-and-files.md
```Python hl_lines="1" {!> ../../../docs_src/request_forms_and_files/tutorial001.py!} ``` ## Определите параметры `File` и `Form` Создайте параметры файла и формы таким же образом, как для `Body` или `Query`: === "Python 3.9+" ```Python hl_lines="10-12" {!> ../../../docs_src/request_forms_and_files/tutorial001_an_py39.py!} ``` === "Python 3.6+" ```Python hl_lines="9-11"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Wed Mar 13 19:02:19 GMT 2024 - 2.9K bytes - Viewed (0) -
docs/zh/docs/tutorial/handling-errors.md
### 使用 `RequestValidationError` 的请求体 `RequestValidationError` 包含其接收到的无效数据请求的 `body` 。 开发时,可以用这个请求体生成日志、调试错误,并返回给用户。 ```Python hl_lines="14" {!../../../docs_src/handling_errors/tutorial005.py!} ``` 现在试着发送一个无效的 `item`,例如: ```JSON { "title": "towel", "size": "XL" } ``` 收到的响应包含 `body` 信息,并说明数据是无效的: ```JSON hl_lines="12-15" { "detail": [ {
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 8.4K bytes - Viewed (0) -
docs/it/docs/index.md
![ReDoc](https://fastapi.tiangolo.com/img/index/index-02-redoc-simple.png) ## Esempio più avanzato Adesso modifica il file `main.py` per ricevere un _body_ da una richiesta `PUT`. Dichiara il _body_ usando le annotazioni di tipo standard di Python, grazie a Pydantic. ```Python hl_lines="2 7-10 23-25" from fastapi import FastAPI from pydantic import BaseModel from typing import Optional
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 23:58:47 GMT 2024 - 19.3K bytes - Viewed (0) -
tests/test_tutorial/test_security/test_tutorial005_an.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Wed Mar 13 19:07:10 GMT 2024 - 15.4K bytes - Viewed (0) -
tests/test_tutorial/test_request_forms_and_files/test_tutorial001_an.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:40:57 GMT 2024 - 9.8K bytes - Viewed (0)