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

Implement a client #48

Open
Tracked by #42
ManiMozaffar opened this issue Jul 22, 2023 · 0 comments
Open
Tracked by #42

Implement a client #48

ManiMozaffar opened this issue Jul 22, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@ManiMozaffar
Copy link
Member

A client is only needed for the purpose of multi accounting in crawler.
for example you want to crawl a website, same url, but with 10 different accounts.

each should have its own pipeline, and logic. So we need a Client class where it can be injected to our script.
then each client, opens an Engine Client, and then use that to login, and then return all those as a list

from fastcrawler.engine import AioHttpEngine

async def get_clients():
    clients = AioHttpEngine.new_client() * 10

    clients = [
         asyncio.gather(
               client.get(...)
               for client in clients
     ]    
    return clients


class MySpider:
    clients = Depends(get_clients)

Simple case would be like that.

-> Note: this is WIP. It will not be included very soon, because right now we have decided this design is over engineered and only useful in few cases

@ManiMozaffar ManiMozaffar added the enhancement New feature or request label Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant