import json from apistar import http from apistar.renderers import Renderer from model.util import alchemyencoder class JSONRenderer(Renderer): media_type = 'application/json' charset = None def render(self, data: http.ResponseData) -> bytes: return json.dumps(data, default=alchemyencoder).encode('utf-8')