Search Options

Results per page
Sort
Preferred Languages
Advance

Results 81 - 90 of 199 for tutorial003 (0.39 sec)

  1. docs_src/generate_clients/tutorial004.js

    Alejandra <******@****.***> 1710416405 +0100
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Mar 14 11:40:05 UTC 2024
    - 1K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/security/get-current-user.md

    {* ../../docs_src/security/tutorial002.py hl[25] *}
    
    ## 获取用户
    
    `get_current_user` 使用创建的(伪)工具函数,该函数接收 `str` 类型的令牌,并返回 Pydantic 的 `User` 模型:
    
    {* ../../docs_src/security/tutorial002.py hl[19:22,26:27] *}
    
    ## 注入当前用户
    
    在*路径操作* 的 `Depends` 中使用 `get_current_user`:
    
    {* ../../docs_src/security/tutorial002.py hl[31] *}
    
    注意,此处把 `current_user` 的类型声明为 Pydantic 的 `User` 模型。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  3. docs/zh/docs/tutorial/body-updates.md

    然后再用它生成一个只含已设置(在请求中所发送)数据,且省略了默认值的 `dict`:
    
    {* ../../docs_src/body_updates/tutorial002.py hl[34] *}
    
    ### 使用 Pydantic 的 `update` 参数
    
    接下来,用 `.copy()` 为已有模型创建调用 `update` 参数的副本,该参数为包含更新数据的 `dict`。
    
    例如,`stored_item_model.copy(update=update_data)`:
    
    {* ../../docs_src/body_updates/tutorial002.py hl[35] *}
    
    ### 更新部分数据小结
    
    简而言之,更新部分数据应:
    
    * 使用 `PATCH` 而不是 `PUT` (可选,也可以用 `PUT`);
    * 提取存储的数据;
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.5K bytes
    - Viewed (0)
  4. docs/fr/docs/tutorial/background-tasks.md

    {* ../../docs_src/background_tasks/tutorial001.py hl[6:9] *}
    
    ## Ajouter une tâche d'arrière-plan
    
    Dans votre *fonction de chemin*, passez votre fonction de tâche à l'objet de type `BackgroundTasks` (`background_tasks` ici) grâce à la méthode `.add_task()` :
    
    
    {* ../../docs_src/background_tasks/tutorial001.py hl[14] *}
    
    `.add_task()` reçoit comme arguments :
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 5.5K bytes
    - Viewed (0)
  5. docs/ko/docs/tutorial/background-tasks.md

    이 경우, 아래 작업은 파일에 쓰는 함수입니다. (이메일 보내기 시물레이션)
    
    그리고 이 작업은 `async`와 `await`를 사용하지 않으므로 일반 `def` 함수로 선언합니다.
    
    {* ../../docs_src/background_tasks/tutorial001.py hl[6:9] *}
    
    ## 백그라운드 작업 추가
    
    _경로 작동 함수_ 내에서 작업 함수를 `.add_task()` 함수 통해 _백그라운드 작업_ 개체에 전달합니다.
    
    {* ../../docs_src/background_tasks/tutorial001.py hl[14] *}
    
    `.add_task()` 함수는 다음과 같은 인자를 받습니다 :
    
    - 백그라운드에서 실행되는 작업 함수 (`write_notification`).
    - 작업 함수에 순서대로 전달되어야 하는 일련의 인자 (`email`).
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 5.2K bytes
    - Viewed (0)
  6. docs/uk/docs/tutorial/response-status-code.md

    Розглянемо ще раз попередній приклад:
    
    {* ../../docs_src/response_status_code/tutorial001.py hl[6] *}
    
    `201` - це код статусу для "Created" (створено).
    
    Але Вам не потрібно запам'ятовувати, що означає кожен із цих кодів.
    
    Ви можете використовувати зручні змінні з `fastapi.status`
    
    {* ../../docs_src/response_status_code/tutorial002.py hl[1,6] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Mar 19 17:04:17 UTC 2025
    - 6.1K bytes
    - Viewed (0)
  7. docs/zh/docs/advanced/response-cookies.md

    # 响应Cookies
    
    ## 使用 `Response` 参数
    
    你可以在 *路径函数* 中定义一个类型为 `Response`的参数,这样你就可以在这个临时响应对象中设置cookie了。
    
    {* ../../docs_src/response_cookies/tutorial002.py hl[1,8:9] *}
    
    而且你还可以根据你的需要响应不同的对象,比如常用的 `dict`,数据库model等。
    
    如果你定义了 `response_model`,程序会自动根据`response_model`来过滤和转换你响应的对象。
    
    **FastAPI** 会使用这个 *临时* 响应对象去装在这些cookies信息 (同样还有headers和状态码等信息), 最终会将这些信息和通过`response_model`转化过的数据合并到最终的响应里。
    
    你也可以在depend中定义`Response`参数,并设置cookie和header。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 2.1K bytes
    - Viewed (0)
  8. docs/ko/docs/tutorial/security/get-current-user.md

    {* ../../docs_src/security/tutorial002.py hl[25] *}
    
    ## 유저 가져오기
    
    `get_current_user`는 토큰을 `str`로 취하고 Pydantic `User` 모델을 반환하는 우리가 만든 (가짜) 유틸리티 함수를 사용합니다.
    
    {* ../../docs_src/security/tutorial002.py hl[19:22,26:27] *}
    
    ## 현재 유저 주입하기
    
    이제 *경로 작동*에서 `get_current_user`와 동일한 `Depends`를 사용할 수 있습니다.
    
    {* ../../docs_src/security/tutorial002.py hl[31] *}
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  9. docs/zh/docs/tutorial/background-tasks.md

    {* ../../docs_src/background_tasks/tutorial001.py hl[1, 13] *}
    
    **FastAPI** 会创建一个 `BackgroundTasks` 类型的对象并作为该参数传入。
    
    ## 创建一个任务函数
    
    创建要作为后台任务运行的函数。
    
    它只是一个可以接收参数的标准函数。
    
    它可以是 `async def` 或普通的 `def` 函数,**FastAPI** 知道如何正确处理。
    
    在这种情况下,任务函数将写入一个文件(模拟发送电子邮件)。
    
    由于写操作不使用 `async` 和 `await`,我们用普通的 `def` 定义函数:
    
    {* ../../docs_src/background_tasks/tutorial001.py hl[6:9] *}
    
    ## 添加后台任务
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Oct 11 17:48:49 UTC 2025
    - 4.7K bytes
    - Viewed (0)
  10. docs/zh/docs/tutorial/response-status-code.md

    ///
    
    ## 状态码名称快捷方式
    
    再看下之前的例子:
    
    {* ../../docs_src/response_status_code/tutorial001.py hl[6] *}
    
    `201` 表示**已创建**的状态码。
    
    但我们没有必要记住所有代码的含义。
    
    可以使用 `fastapi.status` 中的快捷变量。
    
    {* ../../docs_src/response_status_code/tutorial002.py hl[1,6] *}
    
    这只是一种快捷方式,具有相同的数字代码,但它可以使用编辑器的自动补全功能:
    
    <img src="../../../../../../img/tutorial/response-status-code/image02.png">
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 3.6K bytes
    - Viewed (0)
Back to top