apiron icon indicating copy to clipboard operation
apiron copied to clipboard

Add support for asynchronous usage

Open karolzlot opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. I think as this project will grow it is good idea to allow to have async calls to API.

Describe the solution you'd like I think that the best approach is to replace requests with httpx.

Describe alternatives you've considered n/d

Additional context n/d

karolzlot avatar Jan 30 '22 16:01 karolzlot

Thanks for opening this request @karolzlot! We've discussed this a couple of times internally and I think I even looked specifically at httpx briefly to understand what it might look like. This is a very good opportunity, especially if the solution can easily continue to support both synchronous and asynchronous usage.

daneah avatar Jan 30 '22 17:01 daneah

One more idea: as this is package intended to be used by other projects, it may be good idea to implement this funcionality with AnyIO: https://www.python-httpx.org/async/#anyio

karolzlot avatar Feb 01 '22 05:02 karolzlot

I'm not too familiar with AnyIO—I would need to better understand it before weighing in.

I'm also thinking about how we might expose the (optional) async capability in this package—namely, I'd like to avoid or abstract the challenge of code color as much as possible.

daneah avatar Feb 01 '22 11:02 daneah

I was also thinking about it. As far as I can see, there is no ideal solution: https://stackoverflow.com/questions/55152952/duplication-of-code-for-synchronous-and-asynchronous-implementations

karolzlot avatar Feb 02 '22 05:02 karolzlot