Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 111 for DateTime (0.19 sec)

  1. tests/test_datetime_custom_encoder.py

    from datetime import datetime, timezone
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    from .utils import needs_pydanticv1, needs_pydanticv2
    
    
    @needs_pydanticv2
    def test_pydanticv2():
        from pydantic import field_serializer
    
        class ModelWithDatetimeField(BaseModel):
            dt_field: datetime
    
            @field_serializer("dt_field")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 1.6K bytes
    - Viewed (0)
  2. tests/test_serialize_response_dataclass.py

            {
                "name": "baz",
                "date": datetime(2021, 7, 26),
                "price": 2.0,
                "owner_ids": [1, 2, 3],
            },
        ]
    
    
    @app.get("/items/objectlist", response_model=List[Item])
    def get_objectlist():
        return [
            Item(name="foo", date=datetime(2021, 7, 26)),
            Item(name="bar", date=datetime(2021, 7, 26), price=1.0),
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Aug 26 13:56:47 GMT 2022
    - 4.9K bytes
    - Viewed (0)
  3. docs_src/extra_data_types/tutorial001.py

    from datetime import datetime, time, timedelta
    from typing import Union
    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: datetime = Body(),
        end_datetime: datetime = Body(),
        process_after: timedelta = Body(),
        repeat_at: Union[time, None] = Body(default=None),
    ):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 755 bytes
    - Viewed (0)
  4. docs_src/python_types/tutorial011_py310.py

    from datetime import datetime
    
    from pydantic import BaseModel
    
    
    class User(BaseModel):
        id: int
        name: str = "John Doe"
        signup_ts: datetime | None = None
        friends: list[int] = []
    
    
    external_data = {
        "id": "123",
        "signup_ts": "2017-06-01 12:22",
        "friends": [1, "2", b"3"],
    }
    user = User(**external_data)
    print(user)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Sep 02 15:56:35 GMT 2023
    - 461 bytes
    - Viewed (0)
  5. docs/ja/docs/tutorial/extra-data-types.md

        * リクエストとレスポンスでは`str`として表現されます。
    * `datetime.datetime`:
        * Pythonの`datetime.datetime`です。
        * リクエストとレスポンスはISO 8601形式の`str`で表現されます: `2008-09-15T15:53:00+05:00`
    * `datetime.date`:
        * Pythonの`datetime.date`です。
        * リクエストとレスポンスはISO 8601形式の`str`で表現されます: `2008-09-15`
    * `datetime.time`:
        * Pythonの`datetime.time`.
        * リクエストとレスポンスはISO 8601形式の`str`で表現されます: `14:23:55.003`
    * `datetime.timedelta`:
        * Pythonの`datetime.timedelta`です。
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 3.2K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_extra_data_types/test_tutorial001_an_py310.py

                        "properties": {
                            "start_datetime": {
                                "title": "Start Datetime",
                                "type": "string",
                                "format": "date-time",
                            },
                            "end_datetime": {
                                "title": "End Datetime",
                                "type": "string",
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 7K bytes
    - Viewed (0)
  7. docs/ru/docs/tutorial/encoder.md

    ## Использование `jsonable_encoder`
    
    Представим, что у вас есть база данных `fake_db`, которая принимает только JSON-совместимые данные.
    
    Например, он не принимает объекты `datetime`, так как они не совместимы с JSON.
    
    В таком случае объект `datetime` следует преобразовать в строку соответствующую <a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">формату ISO</a>.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 23 13:56:12 GMT 2024
    - 2.8K bytes
    - Viewed (0)
  8. 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,
    ):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 788 bytes
    - Viewed (0)
  9. docs_src/extra_data_types/tutorial001_an.py

    from datetime import datetime, time, timedelta
    from typing import Union
    from uuid import UUID
    
    from fastapi import Body, FastAPI
    from typing_extensions import Annotated
    
    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()],
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Apr 19 00:11:40 GMT 2024
    - 830 bytes
    - Viewed (0)
  10. docs_src/security/tutorial004_an_py310.py

    from datetime import datetime, timedelta, timezone
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
    from jose import JWTError, jwt
    from passlib.context import CryptContext
    from pydantic import BaseModel
    
    # to get a string like this run:
    # openssl rand -hex 32
    SECRET_KEY = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4.1K bytes
    - Viewed (0)
Back to top