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.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

pyserde_timedelta-0.1.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyserde_timedelta-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3977bf49656b5a3a0d8cb4d97c36e2b837844b6bcea4c5cc8dbace6f402025c0
MD5 71ee465cd48eceb06bb0992cdcd5fdf9
BLAKE2b-256 84d468ed006ea06e13795bb94b82def3f55f1c490d123f73117b1f0c99ed674f

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: pyserde_timedelta-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2668a0b6bfcf33acaa52de199b4472eb8919034b3495c311a95678d7d42e5306
MD5 599a22cbb968173a4821f2b66a7ef885
BLAKE2b-256 5abc58f0a454089e8505d817a4c562c8c1daa8f83705d041d720a48c7417fd66

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