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.
13 lines
332 B
Python
13 lines
332 B
Python
import json
|
|
|
|
from apistar import http
|
|
from apistar.renderers import Renderer
|
|
from models.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') |