コンテンツにスキップ
per page, with , order by , clip by
Results of 1 - 7 of about 7 for verify (0.008 sec.)
path operationデコレータの依存関係 11705
path operationデコレータの依存関係 場合によっては path operation関数 の中で依存関係の戻り値を本当に必要としないこともあります。 もしくは、依存関係が値を返さない場合もあります。 しかし、それでも実行・解決する必要があります。 このような場合、 ... です: Python 3.8+ - non-Annotated from fastapi import Depends , FastAPI , Header , HTTPException app = FastAPI () async def verify_token ( x_token : str = Header ()): if x_token != "fake-super-secret-token" : raise HTTPException ( status_code = 400 , de ... tail = "X-Token header invalid" ) async def verify_key ( x_key : str = Header ()): if x_key != "fake-super-secret-key" : raise HTTPException ( status_code = 400 , detail = " ... X-Key header invalid" ) return x_key @app . get ( "/items/" , dependencies = [ Depends ( verify_token ), Depends ( verify_key )]) async def read_items (): return [{ "item" : "Foo" }, { "item" : "Bar" }] ? Other version ...
https://man.mtool.work/fastapi/0.115/tutorial/dependencies/dependencies-in-path-...
OAuth2 scopes 10542
OAuth2 scopes Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use OAuth2 scopes directly with FastAPI , they are integrated to work seamlessly. This would ... "token" , scopes = { "me" : "Read information about the current user." , "items" : "Read items." }, ) app = FastAPI () def verify_password ( plain_password , hashed_password ): return pwd_context . verify ( plain_password , hashed_password ) def get_pa ... er ( fake_db , username : str , password : str ): user = get_user ( fake_db , username ) if not user : return False if not verify_password ( password , user . hashed_password ): return False return user def create_access_token ( data : dict , expires_d ... "token" , scopes = { "me" : "Read information about the current user." , "items" : "Read items." }, ) app = FastAPI () def verify_password ( plain_password , hashed_password ): return pwd_context . verify ( plain_password , hashed_password ) def get_pa ...
https://man.mtool.work/fastapi/0.115/advanced/security/oauth2-scopes/
Global Dependencies 10069
Global Dependencies Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . For some types of applications you might want to add dependencies to the whole application. Sim ... thon 3.9+ from fastapi import Depends , FastAPI , Header , HTTPException from typing_extensions import Annotated async def verify_token ( x_token : Annotated [ str , Header ()]): if x_token != "fake-super-secret-token" : raise HTTPException ( status_co ... de = 400 , detail = "X-Token header invalid" ) async def verify_key ( x_key : Annotated [ str , Header ()]): if x_key != "fake-super-secret-key" : raise HTTPException ( status_code = 400 ... , detail = "X-Key header invalid" ) return x_key app = FastAPI ( dependencies = [ Depends ( verify_token ), Depends ( verify_key )]) @app . get ( "/items/" ) async def read_items (): return [{ "item" : "Portal Gun" }, { " ...
https://man.mtool.work/fastapi/0.115/tutorial/dependencies/global-dependencies/
パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer 10033
パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer これでセキュリティの流れが全てわかったので、 JWT トークンと安全なパスワードのハッシュ化を使用して、実際にアプリケーションを安全にしてみましょう。 このコードは、アプリケーシ ... mes = [ "bcrypt" ], deprecated = "auto" ) oauth2_scheme = OAuth2PasswordBearer ( tokenUrl = "token" ) app = FastAPI () def verify_password ( plain_password , hashed_password ): return pwd_context . verify ( plain_password , hashed_password ) def get_pa ... er ( fake_db , username : str , password : str ): user = get_user ( fake_db , username ) if not user : return False if not verify_password ( password , user . hashed_password ): return False return user def create_access_token ( data : dict , expires_d ... mes = [ "bcrypt" ], deprecated = "auto" ) oauth2_scheme = OAuth2PasswordBearer ( tokenUrl = "token" ) app = FastAPI () def verify_password ( plain_password , hashed_password ): return pwd_context . verify ( plain_password , hashed_password ) def get_pa ...
https://man.mtool.work/fastapi/0.115/tutorial/security/oauth2-jwt/
Form Models 7124
Form Models Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use Pydantic models to declare form fields in FastAPI. Info To use forms, first install python- ... data for each field from the form data in the request and give you the Pydantic model you defined. Check the Docs You can verify it in the docs UI at /docs : Forbid Extra Form Fields In some special use cases (probably not very common), you might want ...
https://man.mtool.work/fastapi/0.115/tutorial/request-form-models/
Async Tests 7088
Async Tests Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You have already seen how to test your FastAPI applications using the provided TestClient . Up to now, ... u're querying your database asynchronously. Imagine you want to test sending requests to your FastAPI application and then verify that your backend successfully wrote the correct data in the database, while using an async database library. Let's look a ...
https://man.mtool.work/fastapi/0.115/advanced/async-tests/
Release Notes 6997
Release Notes Latest Changes 0.115.11 Fixes ? Add docs examples and tests (support) for Annotated custom validations, like AfterValidator , revert #13440 . PR #13442 by @tiangolo . New docs: Query Parameters and String Validations - Custom ... about "Don't Translate these Pages". PR #12022 by @tiangolo . ? Add documentation for non-translated pages and scripts to verify them. PR #12020 by @tiangolo . ? Update docs about discussions questions. PR #11985 by @tiangolo . Translations ? Add Port ... eously introduced by a previous RTL PR). PR #11039 by @tiangolo . ? Add Italian to mkdocs.yml . PR #11016 by @alejsdev . ? Verify mkdocs.yml languages in CI, update docs.py . PR #11009 by @tiangolo . ? Update config in label-approved.yml to accept tran ... ors, add Scalar. PR #10728 by @tiangolo . ? Update sponsors, add PropelAuth. PR #10760 by @tiangolo . ? Update build docs, verify README on CI. PR #10750 by @tiangolo . ? Update sponsors, remove Fern. PR #10729 by @tiangolo . ? Update sponsors, add Cod ...
https://man.mtool.work/fastapi/0.115/release-notes/
PREV 1 NEXT