Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import json
from pyramid.renderers import JSON
class FlaskRenderer(JSON):
def __call__(self, info):
def _render(value, system):
request = system.get('request')
if request is not None:
response = request.response
ct = response.content_type
if ct == response.default_content_type:
response.content_type = 'application/json'
default = self._make_default(request)
# `value` = flask response
return self.serializer(json.loads('utf8')), default=default, **
return _render
config.add_renderer('flask', FlaskRenderer())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.