- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 120 for directed (0.22 sec)
-
docs/es/docs/advanced/response-directly.md
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jan 13 11:57:27 GMT 2024 - 3.2K bytes - Viewed (0) -
docs/zh/docs/advanced/response-directly.md
例如,如果不首先将 Pydantic 模型转换为 `dict`,并将所有数据类型(如 `datetime`、`UUID` 等)转换为兼容 JSON 的类型,则不能将其放入JSONResponse中。 对于这些情况,在将数据传递给响应之前,你可以使用 `jsonable_encoder` 来转换你的数据。 ```Python hl_lines="4 6 20 21" {!../../../docs_src/response_directly/tutorial001.py!} ``` !!! note "技术细节" 你也可以使用 `from starlette.responses import JSONResponse`。 出于方便,**FastAPI** 会提供与 `starlette.responses` 相同的 `fastapi.responses` 给开发者。但是大多数可用的响应都直接来自 Starlette。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu May 12 00:06:16 GMT 2022 - 3.1K bytes - Viewed (0) -
docs/ja/docs/advanced/response-directly.md
例えば、Pydanticモデルを `JSONResponse` に含めるには、すべてのデータ型 (`datetime` や `UUID` など) をJSON互換の型に変換された `dict` に変換しなければなりません。 このようなケースでは、レスポンスにデータを含める前に `jsonable_encoder` を使ってデータを変換できます。 ```Python hl_lines="6-7 21-22" {!../../../docs_src/response_directly/tutorial001.py!} ``` !!! note "技術詳細" また、`from starlette.responses import JSONResponse` も利用できます。
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/advanced/using-request-directly.md
不过,仍可以验证、转换与注释(使用 Pydantic 模型的请求体等)其它正常声明的参数。 但在某些特定情况下,还是需要提取 `Request` 对象。 ## 直接使用 `Request` 对象 假设要在*路径操作函数*中获取客户端 IP 地址和主机。 此时,需要直接访问请求。 ```Python hl_lines="1 7-8" {!../../../docs_src/using_request_directly/tutorial001.py!} ``` 把*路径操作函数*的参数类型声明为 `Request`,**FastAPI** 就能把 `Request` 传递到参数里。 !!! tip "提示" 注意,本例除了声明请求参数之外,还声明了路径参数。 因此,能够提取、验证路径参数、并转换为指定类型,还可以用 OpenAPI 注释。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 22:44:02 GMT 2024 - 2K bytes - Viewed (0) -
docs/en/docs/advanced/middleware.md
## `HTTPSRedirectMiddleware` Enforces that all incoming requests must either be `https` or `wss`. Any incoming requests to `http` or `ws` will be redirected to the secure scheme instead. ```Python hl_lines="2 6" {!../../../docs_src/advanced_middleware/tutorial001.py!} ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 10 18:27:10 GMT 2023 - 4K bytes - Viewed (0) -
docs/en/docs/reference/request.md
# `Request` class You can declare a parameter in a *path operation function* or dependency to be of type `Request` and then you can access the raw request object directly, without any validation, etc. You can import it directly from `fastapi`: ```python from fastapi import Request ``` !!! tip
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 516 bytes - Viewed (0) -
docs/en/docs/benchmarks.md
* **Uvicorn**: * Will have the best performance, as it doesn't have much extra code apart from the server itself.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 3.4K bytes - Viewed (0) -
docs/en/docs/tutorial/security/get-current-user.md
Remember that dependencies can have sub-dependencies? `get_current_user` will have a dependency with the same `oauth2_scheme` we created before. The same as we were doing before in the *path operation* directly, our new dependency `get_current_user` will receive a `token` as a `str` from the sub-dependency `oauth2_scheme`: === "Python 3.10+" ```Python hl_lines="25" {!> ../../../docs_src/security/tutorial002_an_py310.py!}
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Jan 11 16:31:18 GMT 2024 - 7.6K bytes - Viewed (0) -
docs/en/docs/reference/background.md
You can declare a parameter in a *path operation function* or dependency function with the type `BackgroundTasks`, and then you can use it to schedule the execution of background tasks after the response is sent. You can import it directly from `fastapi`: ```python from fastapi import BackgroundTasks ```
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 377 bytes - Viewed (0) -
docs/en/docs/tutorial/testing.md
This allows you to use `pytest` directly without complications. !!! note "Technical Details" You could also use `from starlette.testclient import TestClient`. **FastAPI** provides the same `starlette.testclient` as `fastapi.testclient` just as a convenience for you, the developer. But it comes directly from Starlette. !!! tip
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)