- Sort Score
- Result 10 results
- Languages All
Results 71 - 80 of 386 for dependsOn (0.13 sec)
-
docs_src/security/tutorial004_py310.py
return user async def get_current_active_user(current_user: User = Depends(get_current_user)): if current_user.disabled: raise HTTPException(status_code=400, detail="Inactive user") return current_user @app.post("/token") async def login_for_access_token( form_data: OAuth2PasswordRequestForm = Depends(), ) -> Token:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 4K bytes - Viewed (0) -
docs_src/security/tutorial001_an.py
from fastapi import Depends, FastAPI from fastapi.security import OAuth2PasswordBearer from typing_extensions import Annotated app = FastAPI() oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") @app.get("/items/") async def read_items(token: Annotated[str, Depends(oauth2_scheme)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 319 bytes - Viewed (0) -
docs_src/security/tutorial001_an_py39.py
from typing import Annotated 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: Annotated[str, Depends(oauth2_scheme)]):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 309 bytes - Viewed (0) -
docs_src/dependencies/tutorial001_py310.py
from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters(q: 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 commons @app.get("/users/") async def read_users(commons: dict = Depends(common_parameters)):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jan 07 14:11:31 UTC 2022 - 404 bytes - Viewed (0) -
docs_src/dependencies/tutorial001_an_py310.py
from fastapi import Depends, FastAPI app = FastAPI() async def common_parameters(q: 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 commons @app.get("/users/") async def read_users(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 - 454 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 passlib.context import CryptContext from pydantic import BaseModel, ValidationError # to get a string like this run:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 5.2K bytes - Viewed (0) -
docs_src/security/tutorial005_an_py39.py
from datetime import datetime, timedelta, timezone from typing import Annotated, List, Union import jwt from fastapi import Depends, FastAPI, HTTPException, Security, status from fastapi.security import ( OAuth2PasswordBearer, OAuth2PasswordRequestForm, SecurityScopes, ) from jwt.exceptions import InvalidTokenError from passlib.context import CryptContext from pydantic import BaseModel, ValidationError
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 5.3K bytes - Viewed (0) -
tests/test_dependency_normal_exceptions.py
@app.put("/invalid-user/{user_id}") def put_invalid_user( user_id: str, name: str = Body(), db: dict = Depends(get_database) ): db[user_id] = name raise HTTPException(status_code=400, detail="Invalid user") @app.put("/user/{user_id}") def put_user(user_id: str, name: str = Body(), db: dict = Depends(get_database)): db[user_id] = name return {"message": "OK"} @pytest.fixture(autouse=True)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 1.9K bytes - Viewed (0) -
tests/test_response_change_status_code.py
from fastapi import Depends, FastAPI, Response from fastapi.testclient import TestClient app = FastAPI() async def response_status_setter(response: Response): response.status_code = 201 async def parent_dep(result=Depends(response_status_setter)): return result @app.get("/", dependencies=[Depends(parent_dep)]) async def get_main(): return {"msg": "Hello World"} client = TestClient(app)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Apr 08 04:37:38 UTC 2020 - 589 bytes - Viewed (0) -
docs_src/dependencies/tutorial001_an.py
from typing import Union from fastapi import Depends, FastAPI 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)]): return commons @app.get("/users/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 502 bytes - Viewed (0)