{"id":3393,"library":"aiosonic","title":"Aiosonic","description":"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.","status":"active","version":"0.31.1","language":"python","source_language":"en","source_url":"https://github.com/sonic182/aiosonic","tags":["http client","async","websocket","http/2","asyncio"],"install":[{"cmd":"pip install aiosonic","lang":"bash","label":"Install latest stable"}],"dependencies":[{"reason":"Required for HTTP/2 protocol support.","package":"h2","optional":false},{"reason":"Used for automatic encoding detection in responses.","package":"charset-normalizer","optional":false},{"reason":"Potentially used for DNS caching or similar internal caching mechanisms.","package":"onecache","optional":false}],"imports":[{"symbol":"HTTPClient","correct":"from aiosonic import HTTPClient"},{"symbol":"WebSocketClient","correct":"from aiosonic import WebSocketClient"},{"note":"AioSonicBaseClient was deprecated and renamed to BaseClient. An alias was temporarily restored but is scheduled for removal in 1.x.","wrong":"from aiosonic import AioSonicBaseClient","symbol":"BaseClient","correct":"from aiosonic import BaseClient"}],"quickstart":{"code":"import asyncio\nimport aiosonic\n\nasync def main():\n    client = aiosonic.HTTPClient()\n    try:\n        response = await client.get('https://httpbin.org/get')\n        assert response.status_code == 200\n        print(f\"Status Code: {response.status_code}\")\n        print(f\"Response content: {await response.text()}\")\n    finally:\n        # Ensure client is closed to release resources\n        await client.wait_requests_done()\n\nif __name__ == '__main__':\n    asyncio.run(main())","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.10 or newer before upgrading aiosonic to 0.30.0 or later.","message":"Aiosonic version 0.30.0 dropped official support for Python 3.8 and 3.9. The minimum required Python version is now 3.10.","severity":"breaking","affected_versions":">=0.30.0"},{"fix":"Migrate your code to use `aiosonic.BaseClient` instead of `aiosonic.AioSonicBaseClient` to avoid future breaking changes.","message":"The `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.","severity":"deprecated","affected_versions":">=0.25.0"},{"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.","message":"As 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.","severity":"gotcha","affected_versions":">=0.29.0"},{"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.","message":"In 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.","severity":"gotcha","affected_versions":">=0.26.0"}],"env_vars":null,"search_vec":"'0.31.1':39 '3.10':42 'aioson':1,2 'async':63 'asynchron':9 'asyncio':16,66 'automat':33 'built':14 'chunk':30 'client':11,62 'connect':25 'continu':44 'decompress':34 'evolv':46 'fast':8 'featur':23 'file':28 'focus':49 'follow':37 'handl':32 'http':61 'http/1.1':19 'http/2':21,60,65 'http/websocket':10 'improv':58 'includ':56 'interact':55 'lightweight':5 'like':24 'multipart':27 'network':54 'offer':22 'perform':51 'pool':26 'python':13,41 'recent':57 'redirect':36 'robust':53 'support':18,40 'transfer':31 'upload':29 'version':38 'websocket':64","created_at":"2026-04-11T17:26:12.397276+00:00","updated_at":"2026-04-17T14:35:15.643635+00:00","problems":[{"fix":"pip install aiosonic","cause":"The 'aiosonic' package is not installed in the Python environment.","error":"ModuleNotFoundError: No module named 'aiosonic'"},{"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.","cause":"The 'HTTPClient' class is not found in the 'aiosonic' module, possibly due to an incorrect import or a version mismatch.","error":"AttributeError: module 'aiosonic' has no attribute 'HTTPClient'"},{"fix":"Ensure that all asynchronous functions are awaited using the 'await' keyword, e.g., 'response = await client.get(url)'.","cause":"An asynchronous function was called without awaiting it, leading to a coroutine object being used improperly.","error":"TypeError: 'coroutine' object is not iterable"},{"fix":"Ensure that the event loop is running when performing asynchronous operations. Avoid closing the event loop prematurely.","cause":"An attempt was made to run an asynchronous operation after the event loop has been closed.","error":"RuntimeError: Event loop is closed"},{"fix":"Verify that you have the correct version of 'aiosonic' installed and that the import statement is correct: 'from aiosonic import HTTPClient'.","cause":"The 'HTTPClient' class is not available in the 'aiosonic' module, possibly due to a version mismatch or incorrect installation.","error":"ImportError: cannot import name 'HTTPClient' from 'aiosonic'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.0.5","cli_name":"","cli_version":null,"type":"library","homepage":"https://aiosonic.readthedocs.io/en/latest/","github":"https://github.com/sonic182/aiosonic","docs":null,"changelog":null,"pypi":"https://pypi.org/project/aiosonic/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-29","next_check":"2026-07-28","install_tag":null}}