- Sort Score
- Result 10 results
- Languages All
Results 111 - 120 of 585 for Depends (0.12 sec)
-
docs_src/dependency_testing/tutorial001_an.py
from typing import Union from fastapi import Depends, FastAPI from fastapi.testclient import TestClient from typing_extensions import Annotated app = FastAPI() async def common_parameters( q: Union[str, None] = None, skip: int = 0, limit: int = 100 ): return {"q": q, "skip": skip, "limit": limit} @app.get("/items/") async def read_items(commons: Annotated[dict, Depends(common_parameters)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 1.5K bytes - Viewed (0) -
docs_src/security/tutorial001.py
from fastapi import Depends, FastAPI from fastapi.security import OAuth2PasswordBearer app = FastAPI() oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") @app.get("/items/") async def read_items(token: str = Depends(oauth2_scheme)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 10 17:28:18 UTC 2020 - 269 bytes - Viewed (0) -
tests/test_dependency_security_overrides.py
from typing import List, Tuple from fastapi import Depends, FastAPI, Security from fastapi.security import SecurityScopes from fastapi.testclient import TestClient app = FastAPI() def get_user(required_scopes: SecurityScopes): return "john", required_scopes.scopes def get_user_override(required_scopes: SecurityScopes): return "alice", required_scopes.scopes def get_data(): return [1, 2, 3]
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Jun 14 15:54:46 UTC 2020 - 1.4K bytes - Viewed (0) -
docs/em/docs/advanced/security/oauth2-scopes.md
๐, ๐ฅ ๐ & โ๏ธ `Security` โช๏ธโก๏ธ `fastapi`. ๐ ๐ช โ๏ธ `Security` ๐ฃ ๐ (๐ `Depends`), โ๏ธ `Security` ๐จ ๐ข `scopes` โฎ๏ธ ๐ โ (๐ป). ๐ ๐ผ, ๐ฅ ๐ถโโ๏ธ ๐ ๐ข `get_current_active_user` `Security` (๐ ๐ ๐ฅ ๐ โฎ๏ธ `Depends`). โ๏ธ ๐ฅ ๐ถโโ๏ธ `list` โ, ๐ ๐ผ โฎ๏ธ 1๏ธโฃ โ: `items` (โซ๏ธ ๐ช โ๏ธ ๐ ). & ๐ ๐ข `get_current_active_user` ๐ช ๐ฃ ๐ง-๐, ๐ซ ๐ด โฎ๏ธ `Depends` โ๏ธ โฎ๏ธ `Security`. ๐ฃ ๐ฎ ๐ ๐ง-๐ ๐ข (`get_current_user`), & ๐ โ ๐.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 11K bytes - Viewed (0) -
docs/ko/docs/tutorial/dependencies/index.md
{!> ../../docs_src/dependencies/tutorial001.py!} ``` //// ๋น๋ก `Body`, `Query` ๋ฑ์ ์ฌ์ฉํ๋ ๊ฒ๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์ฌ๋ฌ๋ถ์ ํจ์์ ๋งค๊ฐ๋ณ์์ ์๋ `Depends`๋ฅผ ์ฌ์ฉํ์ง๋ง, `Depends`๋ ์ฝ๊ฐ ๋ค๋ฅด๊ฒ ์๋ํฉ๋๋ค. `Depends`์ ๋จ์ผ ๋งค๊ฐ๋ณ์๋ง ์ ๋ฌํ์ต๋๋ค. ์ด ๋งค๊ฐ๋ณ์๋ ํจ์๊ฐ์ ๊ฒ์ด์ด์ผ ํฉ๋๋ค. ์ฌ๋ฌ๋ถ์ ์ง์ **ํธ์ถํ์ง ์์์ต๋๋ค** (๋์ ๊ดํธ๋ฅผ ์น์ง ์์์ต๋๋ค), ๋จ์ง `Depends()`์ ๋งค๊ฐ๋ณ์๋ก ๋๊ฒจ ์คฌ์ ๋ฟ์ ๋๋ค. ๊ทธ๋ฆฌ๊ณ ๊ทธ ํจ์๋ *๊ฒฝ๋ก ์๋ ํจ์*๊ฐ ์๋ํ๋ ๊ฒ๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๋งค๊ฐ๋ณ์๋ฅผ ๋ฐ์ต๋๋ค. /// tip | "ํ"
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 13.5K bytes - Viewed (0) -
docs_src/settings/app03_an_py39/main.py
from functools import lru_cache from fastapi import Depends, FastAPI from typing_extensions import Annotated from . import config app = FastAPI() @lru_cache def get_settings(): return config.Settings() @app.get("/info") async def info(settings: Annotated[config.Settings, Depends(get_settings)]): return { "app_name": settings.app_name, "admin_email": settings.admin_email,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 462 bytes - Viewed (0) -
docs_src/dependencies/tutorial011_an_py39.py
from typing import Annotated from fastapi import Depends, FastAPI app = FastAPI() class FixedContentQueryChecker: def __init__(self, fixed_content: str): self.fixed_content = fixed_content def __call__(self, q: str = ""): if q: return self.fixed_content in q return False checker = FixedContentQueryChecker("bar") @app.get("/query-checker/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 544 bytes - Viewed (0) -
tests/test_dependency_contextvars.py
from contextvars import ContextVar from typing import Any, Awaitable, Callable, Dict, Optional from fastapi import Depends, FastAPI, Request, Response from fastapi.testclient import TestClient legacy_request_state_context_var: ContextVar[Optional[Dict[str, Any]]] = ContextVar( "legacy_request_state_context_var", default=None ) app = FastAPI() async def set_up_request_state_dependency(): request_state = {"user": "deadpond"}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Feb 17 12:40:12 UTC 2022 - 1.5K bytes - Viewed (0) -
tests/test_security_api_key_cookie.py
from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyCookie from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() api_key = APIKeyCookie(name="key") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user @app.get("/users/me")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.9K bytes - Viewed (0) -
tests/test_security_api_key_cookie_description.py
from fastapi import Depends, FastAPI, Security from fastapi.security import APIKeyCookie from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() api_key = APIKeyCookie(name="key", description="An API Cookie Key") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.1K bytes - Viewed (0)