Skip to main content

Scrapy download handler that integrates aiohttp

Project description

scrapy-aiohttp-downloader

version

scrapy-aiohttp-downloader is a Scrapy download handler.

Installation

pip install scrapy-aiohttp-downloader

Activation

Replace the default http and/or https Download Handlers through DOWNLOAD_HANDLERS

DOWNLOAD_HANDLERS = {
    "http": "scrapy_aiohttp_downloader.AioHTTPDownloadHandler",
    "https": "scrapy_aiohttp_downloader.AioHTTPDownloadHandler",
}

Also, be sure to install the asyncio-based Twisted reactor:

TWISTED_REACTOR = "twisted.internet.asyncioreactor.AsyncioSelectorReactor"

Basic usage

Set the aiohttp Request.meta key to download a request using aiohttp:

import scrapy


class AioHTTPSpider(scrapy.Spider):
    name = "spider"
    custom_settings = {
        "DOWNLOAD_HANDLERS": {
            "http": "scrapy_aiohttp_downloader.AioHTTPDownloadHandler",
            "https": "scrapy_aiohttp_downloader.AioHTTPDownloadHandler",
        },
        "TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor",
    }

    def start_requests(self):
        yield scrapy.Request(
            "https://example.com/",
            meta={"aiohttp": True},
        )

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

scrapy_aiohttp_downloader-1.0.0b2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file scrapy_aiohttp_downloader-1.0.0b2.tar.gz.

File metadata

File hashes

Hashes for scrapy_aiohttp_downloader-1.0.0b2.tar.gz
Algorithm Hash digest
SHA256 7938f0f3be72ceed694de5a00301c8cbe2d4657989cdaad489c7c929c60a2b6f
MD5 9121590fe71224214bb35422cee9f5df
BLAKE2b-256 6632ddc0273aa28eb0a385d44e6faadd3521d3df3358b9c173773e3e2d75f290

See more details on using hashes here.

File details

Details for the file scrapy_aiohttp_downloader-1.0.0b2-py3-none-any.whl.

File metadata

File hashes

Hashes for scrapy_aiohttp_downloader-1.0.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 c0fb34c1c190943204b0ebd31daa01b6dbbf7b4c5f03f5217c7af20b78645b44
MD5 63f7db125a81ce4a4a55e22face372f7
BLAKE2b-256 afcf450ce77ef1ea711ac68077f14c3b9c9c7a345d055242d47d8c49347bf49a

See more details on using hashes here.

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