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

asyncio support #152

Open
uriva opened this issue May 8, 2020 · 5 comments
Open

asyncio support #152

uriva opened this issue May 8, 2020 · 5 comments

Comments

@uriva
Copy link
Contributor

uriva commented May 8, 2020

Slightly related to #147, but thought it deserves its own issue.

@siznax
Copy link
Owner

siznax commented May 8, 2020

Thanks @uriva Could be nice, but please see #141

@uriva
Copy link
Contributor Author

uriva commented Jun 26, 2020

I don't see how this is related, asyncio can help you make parallel requests to two websites, or do cpu intensive work while waiting for io.

@siznax
Copy link
Owner

siznax commented Jun 26, 2020

@uriva You are welcome to submit a PR for this. We'll be interested in ensuring we do not make it easy for our users or this package's user-agent to get banned.

Alternatively, you are welcome to run this package in parallel in your own programs. Why don't you try that first, and see if it is something that may help to have incorporated in this package?

Also, it would help to tell us more about the exact problem you are trying to solve. Maybe there is already a solution.

Good luck!

@siznax siznax closed this as completed Jun 26, 2020
@siznax siznax reopened this Jun 26, 2020
@uriva
Copy link
Contributor Author

uriva commented Jun 28, 2020

My scenario is that I have an IO rich code doing many requests to different rest apis. The entire process is highly time sensitive, so the requests must happen in parallel. The architecture is the code is such that the requests are not coming from a single function but from various places. This means I can't rely on threading/multiprocessing (that would require a global thread pool which is awkward and deadlock prone, as the requests have delicate dependencies). asyncio works great in this scenario, but requires native support of the library (cannot be wrapped from outside). This is because the nature of asyncio in python is cancerous.

@AmoghM
Copy link

AmoghM commented Feb 10, 2021

@siznax I also realised the need for asyncio while extracting pages because function calls such as page.get() is very slow. It can definitely be useful to have the enhancement and put a warning on being getting the user-agent banned.

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

3 participants