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

To set a Set-Cookie header to the response.headers.

Signature:

response.set_cookie(name, value='', expires=0, path='/', domain=None,
                    secure=False, httponly=False, samesite=None)

Example:

# ...

@app.route('/hello')
async def hello_world(request, response):
    response.set_cookie('foo', 'bar')

    return 'Hello, World!'

# ...