- Sort Score
- Result 10 results
- Languages All
Results 31 - 40 of 111 for DateTime (0.17 sec)
-
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 May 05 07:19:11 GMT 2024 - Last Modified: Fri Apr 19 00:11:40 GMT 2024 - 830 bytes - Viewed (0) -
docs/em/docs/tutorial/encoder.md
🖼, 🚥 👆 💪 🏪 ⚫️ 💽. 👈, **FastAPI** 🚚 `jsonable_encoder()` 🔢. ## ⚙️ `jsonable_encoder` ➡️ 🌈 👈 👆 ✔️ 💽 `fake_db` 👈 🕴 📨 🎻 🔗 💽. 🖼, ⚫️ 🚫 📨 `datetime` 🎚, 👈 🚫 🔗 ⏮️ 🎻. , `datetime` 🎚 🔜 ✔️ 🗜 `str` ⚗ 💽 <a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">💾 📁</a>. 🎏 🌌, 👉 💽 🚫🔜 📨 Pydantic 🏷 (🎚 ⏮️ 🔢), 🕴 `dict`.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Apr 01 09:26:04 GMT 2023 - 1.5K bytes - Viewed (0) -
docs_src/python_types/tutorial011_py39.py
from datetime import datetime from typing import Union from pydantic import BaseModel class User(BaseModel): id: int name: str = "John Doe" signup_ts: Union[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 May 05 07:19:11 GMT 2024 - Last Modified: Sat Sep 02 15:56:35 GMT 2023 - 492 bytes - Viewed (0) -
docs/en/docs/tutorial/encoder.md
## Using the `jsonable_encoder` Let's imagine that you have a database `fake_db` that only receives JSON compatible data. For example, it doesn't receive `datetime` objects, as those are not compatible with JSON. So, a `datetime` object would have to be converted to a `str` containing the data in <a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">ISO format</a>.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 17 05:59:11 GMT 2023 - 1.8K bytes - Viewed (0) -
tests/test_jsonable_encoder.py
} @needs_pydanticv1 def test_custom_encoders(): class safe_datetime(datetime): pass class MyModel(BaseModel): dt_field: safe_datetime instance = MyModel(dt_field=safe_datetime.now()) encoded_instance = jsonable_encoder( instance, custom_encoder={safe_datetime: lambda o: o.isoformat()} )
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Thu Apr 18 21:56:59 GMT 2024 - 9K bytes - Viewed (0) -
docs/de/docs/tutorial/extra-data-types.md
* `datetime.datetime`: * Ein Python-`datetime.datetime`. * Wird in Requests und Responses als `str` im ISO 8601-Format dargestellt, etwa: `2008-09-15T15:53:00+05:00`. * `datetime.date`: * Python-`datetime.date`. * Wird in Requests und Responses als `str` im ISO 8601-Format dargestellt, etwa: `2008-09-15`. * `datetime.time`: * Ein Python-`datetime.time`.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 30 18:08:55 GMT 2024 - 4.4K bytes - Viewed (0) -
docs/zh/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 May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 3.9K bytes - Viewed (0) -
docs/zh/docs/tutorial/encoder.md
比如,如果您需要将其存储在数据库中。 对于这种要求, **FastAPI**提供了`jsonable_encoder()`函数。 ## 使用`jsonable_encoder` 让我们假设你有一个数据库名为`fake_db`,它只能接收与JSON兼容的数据。 例如,它不接收`datetime`这类的对象,因为这些对象与JSON不兼容。 因此,`datetime`对象必须将转换为包含<a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">ISO格式化</a>的`str`类型对象。 同样,这个数据库也不会接收Pydantic模型(带有属性的对象),而只接收`dict`。 对此你可以使用`jsonable_encoder`。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Tue Oct 17 05:59:11 GMT 2023 - 1.7K bytes - Viewed (0) -
docs/ja/docs/tutorial/encoder.md
例えば、データベースに保存する必要がある場合です。 そのために、**FastAPI** は`jsonable_encoder()`関数を提供しています。 ## `jsonable_encoder`の使用 JSON互換のデータのみを受信するデータベース`fase_db`があるとしましょう。 例えば、`datetime`オブジェクトはJSONと互換性がないので、このデーターベースには受け取られません。 そのため、`datetime`オブジェクトは<a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">ISO形式</a>のデータを含む`str`に変換されなければなりません。 同様に、このデータベースはPydanticモデル(属性を持つオブジェクト)を受け取らず、`dict`だけを受け取ります。
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Mon Jan 22 20:09:02 GMT 2024 - 1.9K bytes - Viewed (0) -
docs/em/docs/tutorial/extra-data-types.md
* 🐩 "⭐ 😍 🆔", ⚠ 🆔 📚 💽 & ⚙️. * 📨 & 📨 🔜 🎨 `str`. * `datetime.datetime`: * 🐍 `datetime.datetime`. * 📨 & 📨 🔜 🎨 `str` 💾 8️⃣6️⃣0️⃣1️⃣ 📁, 💖: `2008-09-15T15:53:00+05:00`. * `datetime.date`: * 🐍 `datetime.date`. * 📨 & 📨 🔜 🎨 `str` 💾 8️⃣6️⃣0️⃣1️⃣ 📁, 💖: `2008-09-15`. * `datetime.time`: * 🐍 `datetime.time`. * 📨 & 📨 🔜 🎨 `str` 💾 8️⃣6️⃣0️⃣1️⃣ 📁, 💖: `14:23:55.003`.
Plain Text - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 2.6K bytes - Viewed (0)