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/render.py

13 lines
332 B
Python

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