pyserde-timedelta 0.1.1

Last updated:

0 purchases

pyserde-timedelta 0.1.1 Image
pyserde-timedelta 0.1.1 Images
Add to Cart

Description:

pyserdetimedelta 0.1.1

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))

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.