- Sort Score
- Result 10 results
- Languages All
Results 111 - 120 of 617 for depende (0.03 sec)
-
docs_src/dependencies/tutorial008b_py39.py
from fastapi import Depends, FastAPI, HTTPException app = FastAPI() data = { "plumbus": {"description": "Freshly pickled plumbus", "owner": "Morty"}, "portal-gun": {"description": "Gun to create portals", "owner": "Rick"}, } class OwnerError(Exception): pass def get_username(): try: yield "Rick" except OwnerError as e: raise HTTPException(status_code=400, detail=f"Owner error: {e}")
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 735 bytes - Viewed (0) -
docs_src/security/tutorial005_an_py310.py
from datetime import datetime, timedelta, timezone from typing import Annotated import jwt from fastapi import Depends, FastAPI, HTTPException, Security, status from fastapi.security import ( OAuth2PasswordBearer, OAuth2PasswordRequestForm, SecurityScopes, ) from jwt.exceptions import InvalidTokenError from pwdlib import PasswordHash from pydantic import BaseModel, ValidationError # to get a string like this run:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Sep 29 02:57:38 UTC 2025 - 5.3K bytes - Viewed (0) -
docs_src/security/tutorial005_an_py39.py
from datetime import datetime, timedelta, timezone from typing import Annotated, Union import jwt from fastapi import Depends, FastAPI, HTTPException, Security, status from fastapi.security import ( OAuth2PasswordBearer, OAuth2PasswordRequestForm, SecurityScopes, ) from jwt.exceptions import InvalidTokenError from pwdlib import PasswordHash from pydantic import BaseModel, ValidationError # to get a string like this run:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Sep 29 02:57:38 UTC 2025 - 5.3K bytes - Viewed (0) -
docs/en/docs/tutorial/dependencies/sub-dependencies.md
Let's focus on the parameters declared: * Even though this function is a dependency ("dependable") itself, it also declares another dependency (it "depends" on something else). * It depends on the `query_extractor`, and assigns the value returned by it to the parameter `q`. * It also declares an optional `last_query` cookie, as a `str`.
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 3.7K bytes - Viewed (0) -
docs_src/dependency_testing/tutorial001_py39.py
from typing import Union from fastapi import Depends, FastAPI from fastapi.testclient import TestClient 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: dict = Depends(common_parameters)): return {"message": "Hello Items!", "params": commons}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 20:41:43 UTC 2025 - 1.5K bytes - Viewed (0) -
tests/test_security_oauth2_authorization_code_bearer_scopes_openapi_simple.py
) async def get_token(token: Annotated[str, Depends(oauth2_scheme)]) -> str: return token app = FastAPI(dependencies=[Depends(get_token)]) @app.get("/admin", dependencies=[Security(get_token, scopes=["read", "write"])]) async def read_admin(): return {"message": "Admin Access"} client = TestClient(app) def test_read_admin():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 2.6K bytes - Viewed (0) -
docs_src/bigger_applications/app_an_py39/routers/items.py
from fastapi import APIRouter, Depends, HTTPException from ..dependencies import get_token_header router = APIRouter( prefix="/items", tags=["items"], dependencies=[Depends(get_token_header)], responses={404: {"description": "Not found"}}, ) fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}} @router.get("/") async def read_items(): return fake_items_db
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 1011 bytes - Viewed (0) -
docs_src/dependency_testing/tutorial001_an_py39.py
from typing import Annotated, Union from fastapi import Depends, FastAPI from fastapi.testclient import TestClient 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)]): return {"message": "Hello Items!", "params": commons}
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 1.5K bytes - Viewed (0) -
docs_src/security/tutorial005_py39.py
from datetime import datetime, timedelta, timezone from typing import Union import jwt from fastapi import Depends, FastAPI, HTTPException, Security, status from fastapi.security import ( OAuth2PasswordBearer, OAuth2PasswordRequestForm, SecurityScopes, ) from jwt.exceptions import InvalidTokenError from pwdlib import PasswordHash from pydantic import BaseModel, ValidationError # to get a string like this run:
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Mon Sep 29 02:57:38 UTC 2025 - 5.3K bytes - Viewed (0) -
tests/test_security_oauth2_authorization_code_bearer_scopes_openapi.py
) async def get_token(token: Annotated[str, Depends(oauth2_scheme)]) -> str: return token app = FastAPI(dependencies=[Depends(get_token)]) @app.get("/") async def root(): return {"message": "Hello World"} @app.get( "/with-oauth2-scheme", dependencies=[Security(oauth2_scheme, scopes=["read", "write"])], ) async def read_with_oauth2_scheme():
Registered: Sun Dec 28 07:19:09 UTC 2025 - Last Modified: Wed Dec 17 21:25:59 UTC 2025 - 6.6K bytes - Viewed (0)