Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add async support #59

Open
iamkubi opened this issue Sep 18, 2022 · 1 comment
Open

Add async support #59

iamkubi opened this issue Sep 18, 2022 · 1 comment

Comments

@iamkubi
Copy link
Owner

iamkubi commented Sep 18, 2022

This would only be feasible if it leaves the existing behavior intact as synchronous calls. There are ways to write the code as async and have a wrapper that generates a synchronous version. This could potentially be refactored so that pyadctyl exposes get_servers() and async_get_servers() without impacting the existing behavior.

Some relevant links

https://discuss.python.org/t/how-can-async-support-dispatch-between-sync-and-async-variants-of-the-same-code/15014/14
https://gist.github.com/blink1073/969aeba85f32c285235750626f2eadd8
@quswadress
Copy link

Hi, @iamkubi. I made a partially working version with asynchronous calls, and I have a couple of questions for you.

Firstly, what should the documentation look like for synchronous functions? Should it just copy-paste from asynchronous methods or refer to them or something else? The same question I have for tests: if synchronous versions will call asynchronous ones, then it is not necessary to test asynchronous ones directly, am I right?

Or how will synchronous calls work? You can call asynchronous in a new(or existing) loop/thread/etc. But you can just use the existing synchronous requests.Session(or httpx.Client) and don't bother with it. Also, is there no problem here if I use httpx library for asynchronous requests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants