from flask import Blueprint from flask.json import JSONEncoder from datetime import datetime class CustomJsonEncoder(JSONEncoder): def default(self, obj): try: if isinstance(obj, datetime): return obj.strftime("%Y-%m-%dT%H%M") iterable = iter(obj) except TypeError: pass else: return list(iterable) return JSONEncoder.default(self, obj) api = Blueprint("api", __name__) api.json_encoder = CustomJsonEncoder from .errors import * from .appointement import * from .planning import * from .service import * from .ticket import * from .user import *