Registry / http-networking / aiosonic

aiosonic

JSON →
library1.0.5pypypi✓ verified 8d ago

Aiosonic is a lightweight and very fast asynchronous HTTP/WebSocket client for Python, built on `asyncio`. It supports HTTP/1.1 and HTTP/2, offering features like connection pooling, multipart file uploads, chunked transfer handling, automatic decompression, and redirect following. Version 0.31.1 supports Python >= 3.10 and continues to evolve with a focus on performance and robust network interactions, including recent improvements for HTTP/2.

pip install aiosonic
INSTALL
IMPORT
SIG · AIOSONIC
A
aiosonic
http-networkingpythonv1.0.5
Install
2.1s avg
Import
906ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.884s · 20.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.928s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HTTPClient
from aiosonic import HTTPClient
WebSocketClient
from aiosonic import WebSocketClient
BaseClient
from aiosonic import BaseClient
from aiosonic import AioSonicBaseClient
AioSonicBaseClient was deprecated and renamed to BaseClient. An alias was temporarily restored but is scheduled for removal in 1.x.

Initializes an `HTTPClient` to perform a basic GET request to `httpbin.org/get` and prints the status code and response content. It demonstrates the core asynchronous request pattern and proper client cleanup.

import asyncio import aiosonic async def main(): client = aiosonic.HTTPClient() try: response = await client.get('https://httpbin.org/get') assert response.status_code == 200 print(f"Status Code: {response.status_code}") print(f"Response content: {await response.text()}") finally: # Ensure client is closed to release resources await client.wait_requests_done() if __name__ == '__main__': asyncio.run(main())
Debug
Known issues
breakingAiosonic version 0.30.0 dropped official support for Python 3.8 and 3.9. The minimum required Python version is now 3.10.
fix
Upgrade your Python environment to 3.10 or newer before upgrading aiosonic to 0.30.0 or later.
affects: >=0.30.0
deprecatedThe `AioSonicBaseClient` class was renamed to `BaseClient` in earlier versions (around 0.25.0/0.29.0). While a backward-compatible alias was restored in 0.30.1, it emits a `DeprecationWarning` and is scheduled for removal in the first 1.x release.
fix
Migrate your code to use `aiosonic.BaseClient` instead of `aiosonic.AioSonicBaseClient` to avoid future breaking changes.
affects: >=0.25.0
gotchaAs of version 0.29.0, `BaseClient` no longer automatically parses JSON responses. Users who wrapped APIs with `BaseClient` expecting automatic JSON parsing will need to adjust their implementation.
fix
If using `BaseClient` for API wrapping, you must now override the `process_response()` method to customize payload handling and explicitly parse JSON if desired.
affects: >=0.29.0
gotchaIn version 0.26.0, `response.json()` no longer strictly enforces the `Content-Type` header to be `application/json`. It will attempt to parse any valid JSON response regardless of the header.
fix
Be aware that servers sending incorrect `Content-Type` headers for JSON responses will now be parsed. If strict `Content-Type` validation is required, implement a manual check after receiving the response.
affects: >=0.26.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aiosonic'
The 'aiosonic' package is not installed in the Python environment.
fix
pip install aiosonic
AttributeError: module 'aiosonic' has no attribute 'HTTPClient'
The 'HTTPClient' class is not found in the 'aiosonic' module, possibly due to an incorrect import or a version mismatch.
fix
Ensure you are using the correct import statement: 'from aiosonic import HTTPClient'. If the issue persists, verify that you have the latest version of 'aiosonic' installed.
TypeError: 'coroutine' object is not iterable
An asynchronous function was called without awaiting it, leading to a coroutine object being used improperly.
fix
Ensure that all asynchronous functions are awaited using the 'await' keyword, e.g., 'response = await client.get(url)'.
RuntimeError: Event loop is closed
An attempt was made to run an asynchronous operation after the event loop has been closed.
fix
Ensure that the event loop is running when performing asynchronous operations. Avoid closing the event loop prematurely.
ImportError: cannot import name 'HTTPClient' from 'aiosonic'
The 'HTTPClient' class is not available in the 'aiosonic' module, possibly due to a version mismatch or incorrect installation.
fix
Verify that you have the correct version of 'aiosonic' installed and that the import statement is correct: 'from aiosonic import HTTPClient'.
Upgrade
Version history
1.0.5latest on PyPI · released Aug 11, 2026
Audit
Dependencies
h2requiredRequired for HTTP/2 protocol support.
charset-normalizerrequiredUsed for automatic encoding detection in responses.
onecacherequiredPotentially used for DNS caching or similar internal caching mechanisms.
Agent activity
36 hits · last 30 days
node
32
Amazon
1
Resources
aiosonic — pip install aiosonic · libregistry