- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 53 for upsert (0.15 sec)
-
docs/em/docs/tutorial/security/get-current-user.md
```Python hl_lines="3 10-14" {!> ../../../docs_src/security/tutorial002_py310.py!} ``` ## ✍ `get_current_user` 🔗 ➡️ ✍ 🔗 `get_current_user`. 💭 👈 🔗 💪 ✔️ 🎧-🔗 ❓ `get_current_user` 🔜 ✔️ 🔗 ⏮️ 🎏 `oauth2_scheme` 👥 ✍ ⏭. 🎏 👥 🔨 ⏭ *➡ 🛠️* 🔗, 👆 🆕 🔗 `get_current_user` 🔜 📨 `token` `str` ⚪️➡️ 🎧-🔗 `oauth2_scheme`: === "🐍 3️⃣.6️⃣ & 🔛" ```Python hl_lines="25"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Apr 01 09:26:04 GMT 2023 - 4.4K bytes - Viewed (0) -
docs/en/docs/tutorial/security/get-current-user.md
``` ## Create a `get_current_user` dependency Let's create a dependency `get_current_user`. 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`:
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/zh/docs/tutorial/security/get-current-user.md
{!../../../docs_src/security/tutorial002.py!} ``` ## 创建 `get_current_user` 依赖项 创建 `get_current_user` 依赖项。 还记得依赖项支持子依赖项吗? `get_current_user` 使用 `oauth2_scheme` 作为依赖项。 与之前直接在路径操作中的做法相同,新的 `get_current_user` 依赖项从子依赖项 `oauth2_scheme` 中接收 `str` 类型的 `token`: ```Python hl_lines="25" {!../../../docs_src/security/tutorial002.py!} ``` ## 获取用户 `get_current_user` 使用创建的(伪)工具函数,该函数接收 `str` 类型的令牌,并返回 Pydantic 的 `User` 模型:
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 22:46:46 GMT 2024 - 3.5K bytes - Viewed (0) -
docs/zh/docs/tutorial/body-updates.md
`PATCH` 没有 `PUT` 知名,也怎么不常用。 很多人甚至只用 `PUT` 实现部分更新。 **FastAPI** 对此没有任何限制,可以**随意**互换使用这两种操作。 但本指南也会分别介绍这两种操作各自的用途。 ### 使用 Pydantic 的 `exclude_unset` 参数 更新部分数据时,可以在 Pydantic 模型的 `.dict()` 中使用 `exclude_unset` 参数。 比如,`item.dict(exclude_unset=True)`。 这段代码生成的 `dict` 只包含创建 `item` 模型时显式设置的数据,而不包括默认值。 然后再用它生成一个只含已设置(在请求中所发送)数据,且省略了默认值的 `dict`: ```Python hl_lines="34"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 3.6K bytes - Viewed (0) -
docs/zh/docs/tutorial/response-model.md
* `tags: List[str] = []` 具有一个空列表作为默认值: `[]`. 但如果它们并没有存储实际的值,你可能想从结果中忽略它们的默认值。 举个例子,当你在 NoSQL 数据库中保存了具有许多可选属性的模型,但你又不想发送充满默认值的很长的 JSON 响应。 ### 使用 `response_model_exclude_unset` 参数 你可以设置*路径操作装饰器*的 `response_model_exclude_unset=True` 参数: ```Python hl_lines="24" {!../../../docs_src/response_model/tutorial004.py!} ``` 然后响应中将不会包含那些默认值,而是仅有实际设置的值。 因此,如果你向*路径操作*发送 ID 为 `foo` 的商品的请求,则响应(不包括默认值)将为:
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/ja/docs/tutorial/response-model.md
しかし、実際に保存されていない場合には結果からそれらを省略した方が良いかもしれません。 例えば、NoSQLデータベースに多くのオプション属性を持つモデルがあるが、デフォルト値でいっぱいの非常に長いJSONレスポンスを送信したくない場合です。 ### `response_model_exclude_unset`パラメータの使用 *path operation デコレータ*に`response_model_exclude_unset=True`パラメータを設定することができます: ```Python hl_lines="24" {!../../../docs_src/response_model/tutorial004.py!} ``` そして、これらのデフォルト値はレスポンスに含まれず、実際に設定された値のみが含まれます。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.3K bytes - Viewed (0) -
docs/en/docs/tutorial/response-model.md
``` Now, whenever a browser is creating a user with a password, the API will return the same password in the response. In this case, it might not be a problem, because it's the same user sending the password. But if we use the same model for another *path operation*, we could be sending our user's passwords to every client. !!! danger
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 17.9K bytes - Viewed (0) -
docs/en/docs/tutorial/testing.md
Create functions with a name that starts with `test_` (this is standard `pytest` conventions). Use the `TestClient` object the same way as you do with `httpx`. Write simple `assert` statements with the standard Python expressions that you need to check (again, standard `pytest`). ```Python hl_lines="2 12 15-18" {!../../../docs_src/app_testing/tutorial001.py!} ``` !!! 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) -
docs/de/docs/tutorial/first-steps.md
Wenn Sie beispielsweise GraphQL verwenden, führen Sie normalerweise alle Aktionen nur mit „POST“-Operationen durch. ### Schritt 4: Definieren der **Pfadoperation-Funktion** Das ist unsere „**Pfadoperation-Funktion**“: * **Pfad**: ist `/`. * **Operation**: ist `get`. * **Funktion**: ist die Funktion direkt unter dem „Dekorator“ (unter `@app.get("/")`). ```Python hl_lines="7"
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Jan 13 12:16:22 GMT 2024 - 10.5K bytes - Viewed (0) -
docs/ru/docs/python-types.md
В какой-то момент вы бы начали определение функции, у вас были бы готовы параметры... Но затем вы должны вызвать «тот метод, который преобразует первую букву в верхний регистр». Было это `upper`? Или `uppercase`? `first_uppercase`? `capitalize`? Тогда вы попробуете с давним другом программиста: автодополнением редактора.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 14.6K bytes - Viewed (0)