Skip to content

Implement a client  #48

Description

@ManiMozaffar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions