feat(aurora): subclassed jsonencoder to allow for custom behavior
This commit is contained in:
parent
e5cdd3893f
commit
2da76eb51a
1 changed files with 8 additions and 0 deletions
|
@ -68,3 +68,11 @@ class Moderation(BaseModel):
|
|||
return cls(**case)
|
||||
|
||||
return None
|
||||
|
||||
class JSONEncoder(json.JSONEncoder):
|
||||
def default(self, o):
|
||||
if isinstance(o, datetime):
|
||||
return o.timestamp()
|
||||
if isinstance(o, timedelta):
|
||||
return str(o)
|
||||
return super().default(o)
|
||||
|
|
Loading…
Reference in a new issue