- Sort Score
- Result 10 results
- Languages All
Results 871 - 880 of 1,178 for strs (0.01 sec)
-
tests/test_security_oauth2_authorization_code_bearer_description.py
oauth2_scheme = OAuth2AuthorizationCodeBearer( authorizationUrl="authorize", tokenUrl="token", description="OAuth2 Code Bearer", auto_error=True, ) @app.get("/items/") async def read_items(token: Optional[str] = Security(oauth2_scheme)): return {"token": token} client = TestClient(app) def test_no_token(): response = client.get("/items") assert response.status_code == 401, response.text
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.4K bytes - Viewed (0) -
tests/test_security_oauth2_password_bearer_optional.py
from fastapi.testclient import TestClient app = FastAPI() oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/token", auto_error=False) @app.get("/items/") async def read_items(token: Optional[str] = Security(oauth2_scheme)): if token is None: return {"msg": "Create an account first"} return {"token": token} client = TestClient(app) def test_no_token():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.1K bytes - Viewed (0) -
docs/zh/docs/tutorial/body.md
{* ../../docs_src/body/tutorial004_py310.py hl[16] *} 函数参数按如下规则进行识别: - **路径**中声明了相同参数的参数,是路径参数 - 类型是(`int`、`float`、`str`、`bool` 等)**单类型**的参数,是**查询**参数 - 类型是 **Pydantic 模型**的参数,是**请求体** /// note | 笔记 因为默认值是 `None`, FastAPI 会把 `q` 当作可选参数。 FastAPI 不使用 `Optional[str]` 中的 `Optional`, 但 `Optional` 可以让编辑器提供更好的支持,并检测错误。 /// ## 不使用 PydanticRegistered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 5.5K bytes - Viewed (0) -
docs/en/docs/tutorial/path-params-numeric-validations.md
/// tip This is probably not as important or necessary if you use `Annotated`. /// Let's say that you want to declare the query parameter `q` as a required `str`. And you don't need to declare anything else for that parameter, so you don't really need to use `Query`. But you still need to use `Path` for the `item_id` path parameter. And you don't want to use `Annotated` for some reason.
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 6.1K bytes - Viewed (0) -
docs/ja/docs/tutorial/body.md
関数パラメータは以下の様に認識されます: * パラメータが**パス**で宣言されている場合は、優先的にパスパラメータとして扱われます。 * パラメータが**単数型** (`int`、`float`、`str`、`bool` など)の場合は**クエリ**パラメータとして解釈されます。 * パラメータが **Pydantic モデル**型で宣言された場合、リクエスト**ボディ**として解釈されます。 /// note | 備考 FastAPIは、`= None`があるおかげで、`q`がオプショナルだとわかります。 `Optional[str]` の`Optional` はFastAPIでは使用されていません(FastAPIは`str`の部分のみ使用します)。しかし、`Optional[str]` はエディタがコードのエラーを見つけるのを助けてくれます。 /// ## Pydanticを使わない方法
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Jul 26 10:48:11 UTC 2025 - 7.8K bytes - Viewed (0) -
docs/pt/docs/tutorial/body-multiple-params.md
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Nov 12 16:23:57 UTC 2025 - 5.4K bytes - Viewed (0) -
docs/es/docs/tutorial/body-updates.md
Puedes usar el `jsonable_encoder` para convertir los datos de entrada en datos que se puedan almacenar como JSON (por ejemplo, con una base de datos NoSQL). Por ejemplo, convirtiendo `datetime` a `str`. {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *} `PUT` se usa para recibir datos que deben reemplazar los datos existentes. ### Advertencia sobre el reemplazo { #warning-about-replacing }
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Dec 16 16:33:45 UTC 2025 - 5.1K bytes - Viewed (0) -
docs/en/docs/tutorial/query-params.md
{* ../../docs_src/query_params/tutorial005_py39.py hl[6:7] *} Here the query parameter `needy` is a required query parameter of type `str`. If you open in your browser a URL like: ``` http://127.0.0.1:8000/items/foo-item ``` ...without adding the required parameter `needy`, you will see an error like: ```JSON {Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 4.5K bytes - Viewed (0) -
docs/zh/docs/tutorial/body-updates.md
更新数据请用 <a href="https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Methods/PUT" class="external-link" target="_blank">HTTP `PUT`</a> 操作。 把输入数据转换为以 JSON 格式存储的数据(比如,使用 NoSQL 数据库时),可以使用 `jsonable_encoder`。例如,把 `datetime` 转换为 `str`。 {* ../../docs_src/body_updates/tutorial001.py hl[30:35] *} `PUT` 用于接收替换现有数据的数据。 ### 关于更新数据的警告 用 `PUT` 把数据项 `bar` 更新为以下内容时: ```Python { "name": "Barz", "price": 3,
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Nov 18 02:25:44 UTC 2024 - 3.5K bytes - Viewed (0) -
docs/ru/docs/tutorial/body-multiple-params.md
Поскольку по умолчанию, отдельные значения интерпретируются как query-параметры, вам не нужно явно добавлять `Query`, вы можете просто сделать так: ```Python q: Union[str, None] = None ``` Или в Python 3.10 и выше: ```Python q: str | None = None ``` Например: {* ../../docs_src/body_multiple_params/tutorial004_an_py310.py hl[28] *} /// info | Информация
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Tue Sep 30 11:24:39 UTC 2025 - 8.3K bytes - Viewed (0)