Results of 1 - 3 of about 3 for timedelta (0.007 sec.)
- OAuth2 scopes 10938
- 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
...ith Password (and hashing), Bearer with JWT tokens . Now using OAuth2 scopes: Python 3.10+ from datetime import datetime , timedelta , timezone from typing import Annotated import jwt from fastapi import Depends , FastAPI , HTTPException , Security , stat...rd ( password , user . hashed_password ): return False return user def create_access_token ( data : dict , expires_delta : timedelta | None = None ): to_encode = data . copy () if expires_delta : expire = datetime . now ( timezone . utc ) + expires_delta...else : expire = datetime . now ( timezone . utc ) + timedelta ( minutes = 15 ) to_encode . update ({ "exp" : expire }) encoded_jwt = jwt . encode ( to_encode , SECRET_KEY , algorithm =... - https://man.mtool.work/fastapi/0.115/advanced/security/oauth2-scopes/
- パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer 10249
- パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer これでセキュリティの流れが全てわかったので、 JWT トークンと安全なパスワードのハッシュ化を使用して、実際にアプリケーションを安全にしてみましょう。 このコードは、アプリケーシ
...も作成します。 さらに、ユーザーを認証して返す関数も作成します。 Python 3.8+ - non-Annotated from datetime import datetime , timedelta , timezone from typing import Union import jwt from fastapi import Depends , FastAPI , HTTPException , status from fastapi...sword , user . hashed_password ): return False return user def create_access_token ( data : dict , expires_delta : Union [ timedelta , None ] = None ): to_encode = data . copy () if expires_delta : expire = datetime . now ( timezone . utc ) + expires_delt...a else : expire = datetime . now ( timezone . utc ) + timedelta ( minutes = 15 ) to_encode . update ({ "exp" : expire }) encoded_jwt = jwt . encode ( to_encode , SECRET_KEY , algorithm =... - https://man.mtool.work/fastapi/0.115/tutorial/security/oauth2-jwt/
- 追加データ型 6696
- 追加データ型 今までは、以下のような一般的なデータ型を使用してきました: int float str bool しかし、より複雑なデータ型を使用することもできます。 そして、今まで見てきたのと同じ機能を持つことになります: 素晴らしいエディタのサポート 受信したリク
...datetime.time : Pythonの datetime.time . リクエストとレスポンスはISO 8601形式の str で表現されます: 14:23:55.003 datetime.timedelta : Pythonの datetime.timedelta です。 リクエストとレスポンスでは合計秒数の float で表現されます。 Pydanticでは「ISO 8601 ti...使用したパラメータを持つ path operation の例を示します。 Python 3.8+ - non-Annotated from datetime import datetime , time , timedelta from typing import Union from uuid import UUID from fastapi import Body , FastAPI app = FastAPI () @app . put ( "/items/ {...def read_items ( item_id : UUID , start_datetime : datetime = Body (), end_datetime : datetime = Body (), process_after : timedelta = Body (), repeat_at : Union [ time , None ] = Body ( default = None ), ): start_process = start_datetime + process_after... - https://man.mtool.work/fastapi/0.115/tutorial/extra-data-types/
PREV
1
NEXT