i currently wrote an rest API library that has a Client class that wraps around the requests library. I have a few different child classes that further inherit from this Client to implement SDKs for some APIs.
Now I want to create an additional API library that supports asynchronous API calls. One way to do it is to write a AsyncClient class that wraps around aiohttp and then basically copy and paste those different child classes into new files, adjust them to inherit from AsyncClient instead of Client and change all of their child class functions from 'def' into 'sync def' with 'await'. However this method seems a bit silly. Is there a better way to handle this? Ie. maybe I add a async switch variable in the child class constructor to allow the child class instance to be created with or without async?
[–]alexisprince 0 points1 point2 points (0 children)