You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cookie-api/cookie_api/render.py

15 lines
344 B
Python

7 years ago
import json
from cookie_api.models.util import alchemyencoder
7 years ago
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')