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 aiosonicVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade your Python environment to 3.10 or newer before upgrading aiosonic to 0.30.0 or later.
Migrate your code to use `aiosonic.BaseClient` instead of `aiosonic.AioSonicBaseClient` to avoid future breaking changes.
If using `BaseClient` for API wrapping, you must now override the `process_response()` method to customize payload handling and explicitly parse JSON if desired.
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.
pip install aiosonic
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.
Ensure that all asynchronous functions are awaited using the 'await' keyword, e.g., 'response = await client.get(url)'.
Ensure that the event loop is running when performing asynchronous operations. Avoid closing the event loop prematurely.
Verify that you have the correct version of 'aiosonic' installed and that the import statement is correct: 'from aiosonic import HTTPClient'.