Skip to main content

Python asynchronous library for web scraping

Project description

Python async library for web scrapping

PyPI version License: MIT

Build Status codecov codebeat badge Codacy Badge

Installing

pip install aioscrapy

Usage

from aioscrapy import Client, WebClient, SingleSessionPool, Dispatcher, SimpleWorker

class CustomClient(Client[str, dict]):
    def __init__(self, client: WebClient):
        self._client = client

    async def fetch(self, key: str) -> dict:
        data = self._client.fetch(key)
        # Processing data, getting result 
        return {"result": "some_result"}

async def main():
    pool = SingleSessionPool()
    dispatcher = Dispatcher(['https://start-url.example.com'])
    client = CustomClient(WebClient(pool))
    worker = SimpleWorker(dispatcher, client)

    result = await worker.run()
    return result

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aioscrapy-0.1.2.tar.gz (5.2 kB view hashes)

Uploaded Source

Built Distribution

aioscrapy-0.1.2-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page