Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for Datetime (0.18 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
    
    
    def test_pydanticv2():
        from pydantic import field_serializer
    
        class ModelWithDatetimeField(BaseModel):
            dt_field: datetime
    
            @field_serializer("dt_field")
            def serialize_datetime(self, dt_field: datetime):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 817 bytes
    - Viewed (0)
  2. tests/test_jsonable_encoder.py

    import warnings
    from collections import deque
    from dataclasses import dataclass
    from datetime import datetime, timezone
    from decimal import Decimal
    from enum import Enum
    from math import isinf, isnan
    from pathlib import PurePath, PurePosixPath, PureWindowsPath
    from typing import Optional, TypedDict
    
    import pytest
    from fastapi._compat import Undefined
    from fastapi.encoders import jsonable_encoder
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.2K bytes
    - Viewed (0)
  3. fastapi/encoders.py

        else:
            return float(dec_value)
    
    
    ENCODERS_BY_TYPE: dict[type[Any], Callable[[Any], Any]] = {
        bytes: lambda o: o.decode(),
        Color: str,
        datetime.date: isoformat,
        datetime.datetime: isoformat,
        datetime.time: isoformat,
        datetime.timedelta: lambda td: td.total_seconds(),
        Decimal: decimal_encoder,
        Enum: lambda o: o.value,
        frozenset: list,
        deque: list,
        GeneratorType: list,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 10.7K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_python_types/test_tutorial011.py

        assert mock_print.call_count == 2
        call_args = [str(arg.args[0]) for arg in mock_print.call_args_list]
        assert call_args == [
            "id=123 name='John Doe' signup_ts=datetime.datetime(2017, 6, 1, 12, 22) friends=[1, 2, 3]",
            "123",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 691 bytes
    - Viewed (0)
  5. tests/test_tutorial/test_extra_data_types/test_tutorial001.py

                                "start_datetime": {
                                    "title": "Start Datetime",
                                    "type": "string",
                                    "format": "date-time",
                                },
                                "end_datetime": {
                                    "title": "End Datetime",
                                    "type": "string",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.3K bytes
    - Viewed (0)
  6. docs/de/docs/tutorial/body-updates.md

    Sie können den `jsonable_encoder` verwenden, um die empfangenen Daten in etwas zu konvertieren, das als JSON gespeichert werden kann (z. B. in einer NoSQL-Datenbank). Zum Beispiel, um ein `datetime` in einen `str` zu konvertieren.
    
    {* ../../docs_src/body_updates/tutorial001_py310.py hl[28:33] *}
    
    `PUT` wird verwendet, um Daten zu empfangen, die die existierenden Daten ersetzen sollen.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 24 10:28:19 UTC 2025
    - 5.1K bytes
    - Viewed (0)
  7. tests/test_tutorial/test_encoder/test_tutorial001.py

            },
        )
        assert response.status_code == 422
        assert response.json() == {
            "detail": [
                {
                    "loc": ["body", "timestamp"],
                    "msg": "Input should be a valid datetime or date, invalid character in year",
                    "type": "datetime_from_date_parsing",
                    "input": "not a date",
                    "ctx": {"error": "invalid character in year"},
                }
            ]
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 6.7K bytes
    - Viewed (0)
  8. pyproject.toml

        # TODO: remove after upgrading SQLAlchemy to a version that includes the following changes
        # https://github.com/sqlalchemy/sqlalchemy/commit/59521abcc0676e936b31a523bd968fc157fef0c2
        'ignore:datetime\.datetime\.utcfromtimestamp\(\) is deprecated and scheduled for removal in a future version\..*:DeprecationWarning:sqlalchemy',
        # Trio 24.1.0 raises a warning from attrs
        # Ref: https://github.com/python-trio/trio/pull/3054
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  9. docs/de/docs/index.md

        * Konvertieren von Python-Typen (`str`, `int`, `float`, `bool`, `list`, usw.).
        * `datetime`-Objekte.
        * `UUID`-Objekte.
        * Datenbankmodelle.
        * ... und viele mehr.
    * Automatische interaktive API-Dokumentation, einschließlich zwei alternativer Benutzeroberflächen:
        * Swagger UI.
        * ReDoc.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 09:39:53 UTC 2025
    - 25.8K bytes
    - Viewed (0)
  10. docs/en/docs/index.md

        * Convert Python types (`str`, `int`, `float`, `bool`, `list`, etc).
        * `datetime` objects.
        * `UUID` objects.
        * Database models.
        * ...and many more.
    * Automatic interactive API documentation, including 2 alternative user interfaces:
        * Swagger UI.
        * ReDoc.
    
    ---
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Dec 25 11:01:37 UTC 2025
    - 23.5K bytes
    - Viewed (0)
Back to top