Send dict as response in Python Bottle with custom status code Send dict as response in Python Bottle with custom status code json json

Send dict as response in Python Bottle with custom status code


You can set the response.status attribute:

from bottle import response@route('/', method='GET')def homepage():    response.status = 202    return {'foo' : 'bar'}