Renvoie json dans la vue pyramidale.
from pyramid.view import Response
from pyramid.view import view_config
@view_config(route_name='json')
def func(request):
body = u'''
{{
"key": "value"
}}
'''
return Response(body=body, headerlist=[('Content-Type', 'application/json')])
Il sera renvoyé en utilisant la classe Response.
Recommended Posts