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

Replace requests with aiohttp #983

Open
erlendvollset opened this issue Jul 26, 2022 · 9 comments
Open

Replace requests with aiohttp #983

erlendvollset opened this issue Jul 26, 2022 · 9 comments
Assignees

Comments

@erlendvollset
Copy link
Collaborator

erlendvollset commented Jul 26, 2022

We can get performance improvements (both wrt. memory and time) by moving to asyncio and aiohttp. We can let our internal APIs be async, and then use something like this to still support the sync interface we have today. Longer term we can expose a public async API aswell.

This will require significant changes to both HTTPClient/APIClient as well as the unit tests as these are tightly coupled with the requests library by using the responses mocking library.

@thomafred
Copy link

Any update on this? Async support in general would be extremely welcome :)

@haakonvt
Copy link
Contributor

@thomafred I've begun the work to move to httpx (which support both sync and async). The plan is as follows: replace requests with as few surprises as possible, then later design and decide on how we should expose the async API 😄

@haakonvt haakonvt self-assigned this Aug 21, 2024
@thomafred
Copy link

@thomafred I've begun the work to move to httpx (which support both sync and async). The plan is as follows: replace requests with as few surprises as possible, then later design and decide on how we should expose the async API 😄

Awesome :)

@andersfylling
Copy link

What's the status on this?

Also if we just make everything async, we could auto generate a sync client that just wraps it?

@haakonvt
Copy link
Contributor

What's the status on this?

@andersfylling It was not able to get this task prioritized, so I’m working on it on my own time. I’m not entirely sure when it’ll be ready, but I’m hoping after Christmas 🎄

@andersfylling
Copy link

@haakonvt let me know if you want any assistance!

@haakonvt
Copy link
Contributor

Yes! 🚀 Making a temporary channel!

@andersfylling
Copy link

Just out of curiosity what is the decisions behind using httpx over aiohttp?

@haakonvt
Copy link
Contributor

  1. Support for both synchronous and asynchronous making the initial switch easier
  2. What FastAPI uses so I assumed they made a wise choice 😅

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

No branches or pull requests

4 participants