Add Async support with AsyncClient and AsyncOauthClient #5#14
Add Async support with AsyncClient and AsyncOauthClient #5#14Deadpool2000 wants to merge 4 commits intoopenapi:mainfrom
Conversation
|
Thanks @Deadpool2000 , is it possible here split all classes into different files based on files standard names? in a way to have more smallest files instead a single large file for code |
|
Thanks for the great suggestion! I completely agree that splitting the classes is a much cleaner approach. I've just pushed an update where I refactored the code to extract the classes into their own separate files based on their standard names:
To make sure this doesn't break any existing functionality or user implementations, I updated Let me know if this looks good to you or if you need any further adjustments! |
This PR addresses the issue where the SDK was blocking the event loop in async frameworks like aiohttp or FastAPI. I've added full asynchronous support and improved resource management across the board.
What's new?
Context Manager Support: All clients (both sync and async) now support context managers (with and async with). This ensures that the underlying connection pool is properly closed after use, preventing resource leaks.
Simplified Imports: You can now import clients directly from the package root:
from openapi_python_sdk import Client, AsyncClientBetter Tests: Added a new test suite for the async implementation using IsolatedAsyncioTestCase (standard in Python 3.10+).
Quick Usage Example
Verification
Updated the README.md with these usage examples to help users get started.
Let me know if you have any feedback!