{"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":"en","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,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}