Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 32 for timedelta (0.06 seconds)

  1. docs_src/security/tutorial005_an_py310.py

            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=ALGORITHM)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 18:10:35 GMT 2026
    - 5.4K bytes
    - Click Count (0)
  2. docs_src/security/tutorial004_py310.py

            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=ALGORITHM)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 18:10:35 GMT 2026
    - 4.1K bytes
    - Click Count (0)
  3. docs_src/security/tutorial005_py310.py

            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=ALGORITHM)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 18:10:35 GMT 2026
    - 5.3K bytes
    - Click Count (0)
  4. docs_src/security/tutorial004_an_py310.py

            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=ALGORITHM)
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 18:10:35 GMT 2026
    - 4.2K bytes
    - Click Count (0)
  5. docs_src/extra_data_types/tutorial001_an_py310.py

    from datetime import datetime, time, timedelta
    from typing import Annotated
    from uuid import UUID
    
    from fastapi import Body, FastAPI
    
    app = FastAPI()
    
    
    @app.put("/items/{item_id}")
    async def read_items(
        item_id: UUID,
        start_datetime: Annotated[datetime, Body()],
        end_datetime: Annotated[datetime, Body()],
        process_after: Annotated[timedelta, Body()],
        repeat_at: Annotated[time | None, Body()] = None,
    ):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 788 bytes
    - Click Count (0)
  6. scripts/people.py

        one_year_commenters = Counter[str]()
        authors: dict[str, Author] = {}
    
        now = datetime.now(tz=timezone.utc)
        one_month_ago = now - timedelta(days=30)
        three_months_ago = now - timedelta(days=90)
        six_months_ago = now - timedelta(days=180)
        one_year_ago = now - timedelta(days=365)
    
        for discussion in discussion_nodes:
            discussion_author_name = None
            if discussion.author:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Mon Mar 23 13:51:24 GMT 2026
    - 15K bytes
    - Click Count (0)
  7. docs/en/docs/tutorial/security/oauth2-jwt.md

    If the token is invalid, return an HTTP error right away.
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[93:110] *}
    
    ## Update the `/token` *path operation* { #update-the-token-path-operation }
    
    Create a `timedelta` with the expiration time of the token.
    
    Create a real JWT access token and return it.
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[121:136] *}
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 10.7K bytes
    - Click Count (0)
  8. docs/zh-hant/docs/tutorial/security/oauth2-jwt.md

    解碼收到的權杖、驗證它,並回傳目前的使用者。
    
    如果權杖無效,立即回傳一個 HTTP 錯誤。
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[93:110] *}
    
    ## 更新 `/token` 路徑操作 { #update-the-token-path-operation }
    
    用權杖有效期建立一個 `timedelta`。
    
    建立真正的 JWT access token 並回傳它。
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[121:136] *}
    
    ### 關於 JWT「主體」`sub` 的技術細節 { #technical-details-about-the-jwt-subject-sub }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 10.1K bytes
    - Click Count (0)
  9. docs/zh/docs/tutorial/security/oauth2-jwt.md

    解码接收到的令牌,进行校验,并返回当前用户。
    
    如果令牌无效,立即返回一个 HTTP 错误。
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[93:110] *}
    
    ## 更新 `/token` 路径操作 { #update-the-token-path-operation }
    
    用令牌的过期时间创建一个 `timedelta`。
    
    创建一个真正的 JWT 访问令牌并返回它。
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[121:136] *}
    
    ### 关于 JWT “主题” `sub` 的技术细节 { #technical-details-about-the-jwt-subject-sub }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:06:37 GMT 2026
    - 10.1K bytes
    - Click Count (0)
  10. docs/ja/docs/tutorial/security/oauth2-jwt.md

    受け取ったトークンをデコードして検証し、現在のユーザーを返します。
    
    トークンが無効な場合は、すぐにHTTPエラーを返します。
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[93:110] *}
    
    ## `/token` *path operation* の更新 { #update-the-token-path-operation }
    
    トークンの有効期限を表す`timedelta`を作成します。
    
    実際のJWTアクセストークンを作成し、それを返します。
    
    {* ../../docs_src/security/tutorial004_an_py310.py hl[121:136] *}
    
    ### JWTの「subject」`sub` についての技術的な詳細 { #technical-details-about-the-jwt-subject-sub }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 14.6K bytes
    - Click Count (1)
Back to Top