Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 30 of 114 for Datetime (0.03 sec)

  1. 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)
  2. 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)
  3. scripts/contributors.py

        nodes: list[ReviewNode]
    
    
    class PullRequestNode(BaseModel):
        number: int
        labels: Labels
        author: Author | None = None
        title: str
        createdAt: datetime
        lastEditedAt: datetime | None = None
        updatedAt: datetime | None = None
        state: str
        reviews: Reviews
    
    
    class PullRequestEdge(BaseModel):
        cursor: str
        node: PullRequestNode
    
    
    class PullRequests(BaseModel):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Dec 16 12:34:01 UTC 2025
    - 8.6K bytes
    - Viewed (0)
  4. docs_src/encoder/tutorial001_py310.py

    from datetime import datetime
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    fake_db = {}
    
    
    class Item(BaseModel):
        title: str
        timestamp: datetime
        description: str | None = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{id}")
    def update_item(id: str, item: Item):
        json_compatible_item_data = jsonable_encoder(item)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Jan 07 14:11:31 UTC 2022
    - 430 bytes
    - Viewed (0)
  5. docs_src/encoder/tutorial001_py39.py

    from datetime import datetime
    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from pydantic import BaseModel
    
    fake_db = {}
    
    
    class Item(BaseModel):
        title: str
        timestamp: datetime
        description: Union[str, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{id}")
    def update_item(id: str, item: Item):
        json_compatible_item_data = jsonable_encoder(item)
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 461 bytes
    - Viewed (0)
  6. docs_src/response_directly/tutorial001_py39.py

    from datetime import datetime
    from typing import Union
    
    from fastapi import FastAPI
    from fastapi.encoders import jsonable_encoder
    from fastapi.responses import JSONResponse
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        title: str
        timestamp: datetime
        description: Union[str, None] = None
    
    
    app = FastAPI()
    
    
    @app.put("/items/{id}")
    def update_item(id: str, item: Item):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 505 bytes
    - Viewed (0)
  7. docs_src/openapi_webhooks/tutorial001_py39.py

    from datetime import datetime
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Subscription(BaseModel):
        username: str
        monthly_fee: float
        start_date: datetime
    
    
    @app.webhooks.post("new-subscription")
    def new_subscription(body: Subscription):
        """
        When a new user subscribes to your service we'll send you a POST request with this
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 550 bytes
    - Viewed (0)
  8. docs_src/security/tutorial004_py310.py

    from datetime import datetime, timedelta, timezone
    
    import jwt
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from jwt.exceptions import InvalidTokenError
    from pwdlib import PasswordHash
    from pydantic import BaseModel
    
    # to get a string like this run:
    # openssl rand -hex 32
    SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 02:57:38 UTC 2025
    - 4K bytes
    - Viewed (0)
  9. docs_src/security/tutorial004_py39.py

    from datetime import datetime, timedelta, timezone
    from typing import Union
    
    import jwt
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from jwt.exceptions import InvalidTokenError
    from pwdlib import PasswordHash
    from pydantic import BaseModel
    
    # to get a string like this run:
    # openssl rand -hex 32
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 4.1K bytes
    - Viewed (0)
  10. docs/ja/docs/tutorial/encoder.md

    例えば、データベースに保存する必要がある場合です。
    
    そのために、**FastAPI** は`jsonable_encoder()`関数を提供しています。
    
    ## `jsonable_encoder`の使用
    
    JSON互換のデータのみを受信するデータベース`fake_db`があるとしましょう。
    
    例えば、`datetime`オブジェクトはJSONと互換性がないので、このデーターベースには受け取られません。
    
    そのため、`datetime`オブジェクトは<a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">ISO形式</a>のデータを含む`str`に変換されなければなりません。
    
    同様に、このデータベースはPydanticモデル(属性を持つオブジェクト)を受け取らず、`dict`だけを受け取ります。
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sun Jun 22 14:36:05 UTC 2025
    - 1.9K bytes
    - Viewed (0)
Back to top