import json from cookie_api.models.util import alchemyencoder from apistar import http from apistar.renderers import Renderer 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')