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 Support #242

Open
fasihhussain00 opened this issue Feb 8, 2025 · 1 comment
Open

Async Support #242

fasihhussain00 opened this issue Feb 8, 2025 · 1 comment
Labels

Comments

@fasihhussain00
Copy link
Contributor

I’ve been using this library for scraping tasks and encountered a performance issue that could be resolved with the integration of aiohttp for asynchronous network calls.

Currently, while performing scraping operations, the CPU-intensive tasks get blocked due to synchronous network requests, leading to inefficiencies. One way to improve this is by using aiohttp, which would allow the network calls to be handled asynchronously, thus preventing CPU-bound tasks from being delayed or blocked.

e.g.

async with session.post(url, headers=headers) as response:
    response.raise_for_status()
    raw_data = await response.text()

Moreover, using aiohttp could help avoid the need for creating multiple threads to execute the scraping jobs quickly we can just use event loop, which in turn would reduce the complexity and improve the overall performance of the application.

It would be great if the library could consider switching to or adding an option for aiohttp for the network requests.

Looking forward to hearing from you guys.

@cullenwatson
Copy link
Owner

yep I agree

@cullenwatson cullenwatson pinned this issue Feb 21, 2025
@cullenwatson cullenwatson unpinned this issue Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants