---
title: "AIOHTTP Client"
description: "Learn about the AIOHTTP integration and how it adds support for the AIOHTTP HTTP client."
url: https://docs.sentry.io/platforms/python/integrations/aiohttp/aiohttp-client/
---

# AIOHTTP Client for Python

The [AIOHTTP](https://docs.aiohttp.org/en/stable/) integration instruments outgoing HTTP requests using the AIOHTTP client.

Use this integration to create spans for outgoing requests and ensure traces are properly propagated to downstream services.

This integration also supports AIOHTTP servers. See [AIOHTTP server documentation](https://docs.sentry.io/platforms/python/integrations/aiohttp.md) for details.

In SDK `3.x`, and in stream mode in SDK `2.x`, this page's references to "transaction" apply to service spans instead. See [Streamed Spans](https://docs.sentry.io/platforms/python/tracing/streamed-spans.md) for more information.

## [Install](https://docs.sentry.io/platforms/python/integrations/aiohttp/aiohttp-client.md#install)

Install `sentry-sdk` from PyPI:

```bash
pip install sentry-sdk
```

*Other available variations of the above snippet: uv*

## [Configure](https://docs.sentry.io/platforms/python/integrations/aiohttp/aiohttp-client.md#configure)

If you have the `aiohttp` package in your dependencies, the AIOHTTP integration will be enabled automatically when you initialize the Sentry SDK.

Error Monitoring\[ ]Tracing\[ ]Profiling

```python
import sentry_sdk

sentry_sdk.init(
    dsn="https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
    # Check https://docs.sentry.io/platforms/python/data-management/data-collected/ to configure what data is collected
    data_collection={
        "user_info": True,
    },
    # ___PRODUCT_OPTION_START___ performance
    # Set traces_sample_rate to 1.0 to capture 100%
    # of service spans for tracing.
    traces_sample_rate=1.0,
    # ___PRODUCT_OPTION_END___ performance
    # ___PRODUCT_OPTION_START___ profiling
    # To collect profiles for all profile sessions,
    # set `profile_session_sample_rate` to 1.0.
    profile_session_sample_rate=1.0,
    # Profiles will be automatically collected while
    # there is an active span.
    profile_lifecycle="trace",
    # ___PRODUCT_OPTION_END___ profiling
)
```

## [Verify](https://docs.sentry.io/platforms/python/integrations/aiohttp/aiohttp-client.md#verify)

```python
import asyncio
import aiohttp

async def main():
    sentry_sdk.init(...)  # same as above

    # In SDK 2.x, use sentry_sdk.start_transaction(name="testing_sentry") instead
    with sentry_sdk.start_span(name="testing_sentry"):
        async with aiohttp.ClientSession() as session:
            async with session.get("https://sentry.io/") as response:
                print("Status:", response.status)
            async with session.post("http://httpbin.org/post") as response:
                print("Status:", response.status)

asyncio.run(main())
```

This will create a service span called `testing_sentry`, visible in the Traces section of [sentry.io](https://sentry.io), with child spans for the outgoing HTTP requests.

It takes a couple of moments for the data to appear in [sentry.io](https://sentry.io).

## [Supported Versions](https://docs.sentry.io/platforms/python/integrations/aiohttp/aiohttp-client.md#supported-versions)

* AIOHTTP:

  * 3.4+ (SDK <3.0)
  * 3.7+ (SDK 3.0+)

* Python: 3.7+

---

Find other pages: [Sitemap](https://docs.sentry.io/sitemap.md) lists every page with a one-line summary, and [llms.txt](https://docs.sentry.io/llms.txt) gives an overview with guidance for agents.
