Comparing
Async http client/server framework (asyncio)
Retry any Python function with exponential backoff, jitter, and custom stop conditions — three decorator lines replace 30 lines of retry logic.
| Metric | aiohttp | tenacity |
|---|---|---|
| Ecosystem | Python | Python |
| Difficulty | Beginner | Beginner |
| Weekly downloads | 0 | 5.0M↑ |
| Latest version | v3.13.5 | v8.5.0 |
| Recipes | 1 | 2↑ |
aiohttp only
Shared
tenacity only
Use aiohttp when you need a battle-tested async HTTP client or server, especially in applications that make many concurrent HTTP calls (scrapers, API aggregators) or build lightweight async web services. It has a mature ecosystem and is widely used in production.
Any I/O that can fail transiently: HTTP calls, database queries, queue operations, cloud API calls, file system operations on network drives.
For new async API projects, FastAPI (built on Starlette/uvicorn) has better developer ergonomics, automatic validation, and docs. For synchronous scripts, requests is simpler. httpx offers a compatible API with both sync and async modes if you want flexibility.
Don't retry non-idempotent operations (POST that creates resources) without careful thought. Don't retry errors that won't resolve with time (auth failures, 400 Bad Request).
aiohttp
tenacity