feat: Include Async support
Feature Request
Describe the Feature Request
Request was made to potentially add async support.
What about using FastAPI framework?
I would love to see async support.
Absolutely. Using NetBox API is IMO a prime candidate for async: some calls often take a long time to execute, and giving the client a flexible possibility to do other tasks meanwhile is important.
requests made API calls easy, but it won't get async support. I think it shouldn't be used in new API wrappers anymore. There are other options that support async and are used in very similar way to requests.
There was some discussion in slack about using aiohttp or httpx
Here is a good overview: https://www.scrapingbee.com/blog/best-python-http-clients/
I'm leaning towards httpx (https://github.com/encode/httpx/), seems to have all the features of aiohttp and supports http2 if needed, also more compatible with the current requests library. Interest in it (from github stars and such, seems to be growing faster then aiohttp).
It makes sense to me to use a library that's compatible with requests, has async support, and a large community behind it. I'm not sure what, if anything, aiohttp offers over httpx.
I use httpx a lot for internal API clients and it's a great library. The lead maintainer is the same behind Django REST Framework and really knows HTTP.
The httpx APIs for async and sync are nearly identical, so it's quite easy to mix the two. I'd highly recommend it.
Uplink is a declarative HTTP client, which supports both sync and async I/O: https://github.com/prkumar/uplink
I'd be interested in updating this with async support via httpx. I have it "working" currently minus some of the features in baseapi like all(). This is by shimming over your current implementation, but can pluck the changes to a PR to get async running.
However, your setup docs mention poetry, but I think that is out of date? Any chance you could let me know how to get the dev environment tooling setup?