If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.

GET https://buildwithfern.com/learn/sdks/generators/python/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiJmYjQxZWZjZS02MmY1LTQ2OGUtYTUwOS1lOGQxOWVjODYwODYiLCJleHAiOjE3NzYzMTE2OTksImlhdCI6MTc3NjMxMTM5OX0.al5xN-eGiBUD-q1nZfmNPgvm84cJq4fCWulRAsZ4ENY

---

***

title: aiohttp support
headline: aiohttp support (Python)
description: Fern-generated Python SDKs auto-detect aiohttp for async HTTP operations, resolving DNS concurrency issues without requiring code changes.
---------------------

For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

Every Fern-generated Python SDK ships with opt-in support for [aiohttp](https://docs.aiohttp.org/) as an async HTTP transport. When the `aiohttp` optional extra is installed, the generated async client uses it automatically instead of the default `httpx.AsyncClient`.

This matters for SDKs that make many concurrent async API calls: `httpx.AsyncClient` serializes DNS lookups via `asyncio.getaddrinfo` under heavy concurrency, while `aiohttp` uses its own resolver to avoid that bottleneck.

No generator configuration is required. The `[aiohttp]` extra, runtime auto-detection, and CI coverage are generated for every Python SDK.

## Installation

SDK users opt in by installing the `aiohttp` extra alongside your package:

```bash
pip install your-package[aiohttp]
```

Or with Poetry:

```bash
poetry add "your-package[aiohttp]"
```

If a user passes a custom `httpx_client` to the async client constructor, auto-detection is skipped and the provided client is used as-is.

## Generated dependencies

The generated `pyproject.toml` includes an `[aiohttp]` optional dependency group:

```toml title="pyproject.toml"
[tool.poetry.extras]
aiohttp = ["aiohttp", "httpx-aiohttp"]
```

If you define your own extras via the [`extras`](/sdks/overview/python/configuration#extras) configuration option in `generators.yml`, the built-in `aiohttp` extra is preserved and merged with your custom configuration.

## CI testing

The generated GitHub Actions workflow runs tests in two passes so both transport paths are covered:

1. Standard tests without the aiohttp extra.
2. Tests marked `@pytest.mark.aiohttp` with the extra installed.

To verify the aiohttp path locally:

```bash
poetry install --extras aiohttp
poetry run pytest -m aiohttp
```