Update dependencies and fix deprecations
This commit is contained in:
parent
0d4fbef13d
commit
19d264a03b
8 changed files with 154 additions and 131 deletions
|
|
@ -1 +1 @@
|
|||
from .json_encoder import JSONEncoder
|
||||
from .json_provider import JSONProvider
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from flask.json import JSONEncoder as _FlaskJSONEncoder
|
||||
from flask.json.provider import DefaultJSONProvider
|
||||
|
||||
__all__ = [
|
||||
'JSONEncoder',
|
||||
'JSONProvider',
|
||||
]
|
||||
|
||||
|
||||
class JSONEncoder(_FlaskJSONEncoder):
|
||||
class JSONProvider(DefaultJSONProvider):
|
||||
"""
|
||||
Custom JSON encoder built on top of the Flask JSONEncoder class.
|
||||
Custom JSON provider.
|
||||
"""
|
||||
|
||||
def default(self, obj: Any) -> Any:
|
||||
|
|
@ -25,5 +25,5 @@ class JSONEncoder(_FlaskJSONEncoder):
|
|||
if hasattr(obj, 'to_dict'):
|
||||
return obj.to_dict()
|
||||
|
||||
# Fallback to the Flask JSONEncoder
|
||||
# Fallback to the default JSON provider
|
||||
return super().default(obj)
|
||||
Loading…
Add table
Add a link
Reference in a new issue