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

async and await #2801

Closed
screendriver opened this issue Oct 3, 2015 · 1 comment
Closed

async and await #2801

screendriver opened this issue Oct 3, 2015 · 1 comment

Comments

@screendriver
Copy link

Python 3.5 introduced coroutines with async and await syntax. Specification about that can be read in PEP 492.

Are there any plans to support this? Because of network lags or slow connections it would make sense to make asynchronous http requests.

@Lukasa
Copy link
Member

Lukasa commented Oct 3, 2015

@screendriver At the current time there are no plans to support async and await. This is not because they aren't a good idea: they are. It's because to use them requires quite substantial code changes.

Right now requests is a purely synchronous library that, at the bottom of its stack, uses httplib to send and receive data. We cannot move to an async model unless we replace httplib. The best we could do is provide a shorthand to run a request in a thread, but asyncio already has just such a shorthand, so I don't believe it would be valuable.

Right now I am quietly looking at whether we can rewrite requests to work just as well in a synchronous environment as in an async one. However, the reality is that doing so will be a lot of work, involving rewriting a lot of our stack, and may not happen for many years, if ever.

@Lukasa Lukasa closed this as completed Oct 3, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants