Skip to main content Link Menu Expand (external link) Document Search Copy Copied

To set the HTTP status code.

Example:

# ...

@app.route('/hello')
async def hello_world(request, response):
    response.set_status(403, 'Forbidden')

    return 'Hello, World!'

# ...