The AIOHTTP integration adds support for the AIOHTTP-Server Web Framework. A Python version of 3.6 or greater is required.
Install sentry-sdk
from PyPI:
$ pip install --upgrade sentry-sdk
If you're on Python 3.6, you also need the aiocontextvars
package:
$ pip install --upgrade aiocontextvars
Initialize the SDK before starting the server:
import sentry_sdk
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
sentry_sdk.init(
dsn="YOUR-GLITCHTIP-DSN-HERE",
integrations=[AioHttpIntegration()]
)
from aiohttp import web
async def hello(request):
return web.Response(text="Hello, world")
app = web.Application()
app.add_routes([web.get('/', hello)])
web.run_app(app)