Skip to main content

pyserde extension for (de)serializing timedelta

Project description

pyserde extension for datetime.timedelta.

import serde_timedelta
from serde import serde
from serde.json import to_json, from_json
from datetime import timedelta

# Initialize serde_timedelta extension.
serde_timedelta.init()


@serde
class Foo:
    a: timedelta


f = Foo(timedelta(hours=10))
json = to_json(f)
print(json)                  # Prints {"a":"PT10H"}
print(from_json(Foo, json))  # Prints Foo(a=datetime.timedelta(seconds=36000))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyserde_timedelta-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

pyserde_timedelta-0.1.0-py3-none-any.whl (2.7 kB view details)

Uploaded Python 3

File details

Details for the file pyserde_timedelta-0.1.0.tar.gz.

File metadata

  • Download URL: pyserde_timedelta-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.2.0-39-generic

File hashes

Hashes for pyserde_timedelta-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6104d63ed8d6d03bf7d93e9bdc1183cd52d544c1de8e5cc03ab51cd4896ed501
MD5 1df430f01487a96903f90b3963f888e5
BLAKE2b-256 2e40ec9086c4eda3d269e46d642ad6466b1537a37606893f70d389a79bf76a3f

See more details on using hashes here.

Provenance

File details

Details for the file pyserde_timedelta-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyserde_timedelta-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.12 Linux/6.2.0-39-generic

File hashes

Hashes for pyserde_timedelta-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ad6631949b8afbe8d07f3c5882ed28cbb7a7f53353f05c295ba4f276187b2a0
MD5 9670a705c0c33a362b16236868f7e35d
BLAKE2b-256 74e058626f6a2e9b8766f1af73c49600469f9e048678528c1807807e190bc136

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page