- Sort Score
- Num 10 results
- Language All
Results 191 - 200 of 736 for depende (0.08 seconds)
-
docs/tr/docs/tutorial/security/get-current-user.md
{* ../../docs_src/security/tutorial002_an_py310.py hl[19:22,26:27] *} ## Mevcut kullanıcıyı enjekte edin { #inject-the-current-user } Artık *path operation* içinde `get_current_user` ile aynı `Depends` yaklaşımını kullanabiliriz: {* ../../docs_src/security/tutorial002_an_py310.py hl[31] *} `current_user` tipini Pydantic `User` modeli olarak belirttiğimize dikkat edin.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Feb 13 12:41:38 GMT 2026 - 4.4K bytes - Click Count (0) -
tests/test_security_api_key_query_description.py
from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyQuery from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() api_key = APIKeyQuery(name="key", description="API Key Query") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 2.2K bytes - Click Count (0) -
tests/test_security_api_key_query_optional.py
from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyQuery from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() api_key = APIKeyQuery(name="key", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: str | None = Security(api_key)): if oauth_header is None: return None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 2.1K bytes - Click Count (0) -
tests/test_generic_parameterless_depends.py
from typing import Annotated, TypeVar from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from inline_snapshot import snapshot app = FastAPI() T = TypeVar("T") Dep = Annotated[T, Depends()] class A: pass class B: pass @app.get("/a") async def a(dep: Dep[A]): return {"cls": dep.__class__.__name__} @app.get("/b") async def b(dep: Dep[B]):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Sun Feb 08 10:18:38 GMT 2026 - 2K bytes - Click Count (0) -
tests/test_filter_pydantic_sub_model_pv2.py
import pytest from dirty_equals import HasRepr from fastapi import Depends, FastAPI from fastapi.exceptions import ResponseValidationError from fastapi.testclient import TestClient from inline_snapshot import snapshot @pytest.fixture(name="client") def get_client(): from pydantic import BaseModel, ValidationInfo, field_validator app = FastAPI() class ModelB(BaseModel): username: str class ModelC(ModelB):
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 6.7K bytes - Click Count (0) -
tests/test_security_api_key_cookie_optional.py
from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyCookie from fastapi.testclient import TestClient from inline_snapshot import snapshot from pydantic import BaseModel app = FastAPI() api_key = APIKeyCookie(name="key", auto_error=False) class User(BaseModel): username: str def get_current_user(oauth_header: str | None = Security(api_key)): if oauth_header is None: return None
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Tue Feb 17 09:59:14 GMT 2026 - 2.2K bytes - Click Count (0) -
docs/uk/docs/advanced/advanced-dependencies.md
У версії 0.121.0 **FastAPI** додано підтримку `Depends(scope="function")` для залежностей з `yield`. З `Depends(scope="function")` завершальний код після `yield` виконується одразу після завершення *функції операції шляху*, до того як відповідь буде надіслана клієнту. А при використанні `Depends(scope="request")` (типове значення) завершальний код після `yield` виконується після відправлення відповіді.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:27:41 GMT 2026 - 13.9K bytes - Click Count (0) -
docs/ru/docs/tutorial/security/get-current-user.md
{* ../../docs_src/security/tutorial002_an_py310.py hl[19:22,26:27] *} ## Внедрить текущего пользователя { #inject-the-current-user } Теперь мы можем использовать тот же `Depends` с нашей `get_current_user` в *операции пути*: {* ../../docs_src/security/tutorial002_an_py310.py hl[31] *} Обратите внимание, что мы объявляем тип `current_user` как Pydantic-модель `User`.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 19:57:34 GMT 2026 - 6.9K bytes - Click Count (0) -
docs/zh/docs/advanced/security/oauth2-scopes.md
现在我们声明,路径操作 `/users/me/items/` 需要作用域 `items`。 为此,从 `fastapi` 导入并使用 `Security`。 你可以用 `Security` 来声明依赖(就像 `Depends` 一样),但 `Security` 还接收一个 `scopes` 参数,其值是作用域(字符串)列表。 在这里,我们把依赖函数 `get_current_active_user` 传给 `Security`(就像用 `Depends` 一样)。 同时还传入一个作用域 `list`,此处仅包含一个作用域:`items`(也可以包含更多)。 依赖函数 `get_current_active_user` 也可以声明子依赖,不仅可以用 `Depends`,也可以用 `Security`。它声明了自己的子依赖函数(`get_current_user`),并添加了更多的作用域需求。 在这个例子里,它需要作用域 `me`(也可以需要多个作用域)。
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 13K bytes - Click Count (0) -
docs/zh-hant/docs/advanced/security/oauth2-scopes.md
為此,我們從 `fastapi` 匯入並使用 `Security`。 你可以使用 `Security` 來宣告相依性(就像 `Depends`),但 `Security` 也能接收參數 `scopes`,其為 scopes(字串)的列表。 在這裡,我們將相依函式 `get_current_active_user` 傳給 `Security`(就像使用 `Depends` 一樣)。 但同時也傳入一個 `list` 的 scopes,這裡只有一個 scope:`items`(當然也可以有更多)。 而相依函式 `get_current_active_user` 也能宣告子相依性,不只用 `Depends`,也能用 `Security`。它宣告了自己的子相依函式(`get_current_user`),並加入更多 scope 要求。 在這個例子中,它要求 `me` 這個 scope(也可以要求多個)。
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 12.7K bytes - Click Count (0)