Skip to main content

Page Object pattern for Scrapy

Project description

PyPI Version Supported Python Versions Build Status Coverage report Documentation Status

scrapy-poet is the web-poet Page Object pattern implementation for Scrapy. scrapy-poet allows to write spiders where extraction logic is separated from the crawling one. With scrapy-poet is possible to make a single spider that supports many sites with different layouts.

Requires Python 3.10+ and Scrapy >= 2.6.0.

Read the documentation for more information.

License is BSD 3-clause.

Quick Start

Installation

pip install scrapy-poet

Usage in a Scrapy Project

Add the following inside Scrapy’s settings.py file:

  • Scrapy ≥ 2.10:

    ADDONS = {
        "scrapy_poet.Addon": 300,
    }
  • Scrapy < 2.10:

    DOWNLOADER_MIDDLEWARES = {
        "scrapy_poet.InjectionMiddleware": 543,
        "scrapy.downloadermiddlewares.stats.DownloaderStats": None,
        "scrapy_poet.DownloaderStatsMiddleware": 850,
    }
    REQUEST_FINGERPRINTER_CLASS = "scrapy_poet.ScrapyPoetRequestFingerprinter"
    SPIDER_MIDDLEWARES = {
        "scrapy_poet.RetryMiddleware": 275,
    }

Developing

Setup your local Python environment via:

  1. pip install -r requirements-dev.txt

  2. pre-commit install

Now everytime you perform a git commit, these tools will run against the staged files:

  • black

  • isort

  • flake8

You can also directly invoke pre-commit run –all-files or tox -e linters to run them without performing a commit.

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_poet-0.27.2.tar.gz (91.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scrapy_poet-0.27.2-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file scrapy_poet-0.27.2.tar.gz.

File metadata

  • Download URL: scrapy_poet-0.27.2.tar.gz
  • Upload date:
  • Size: 91.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scrapy_poet-0.27.2.tar.gz
Algorithm Hash digest
SHA256 32f39d7d287c345f5292a692c68bebed257eb0d271273c7149a6a1054f09118a
MD5 8c22660a780e1dae26daaeaae101315b
BLAKE2b-256 490cf6e2433c251f68cbcc1541f7ae9ea53accaeb45ccfdbabcd1fee6c150f89

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapy_poet-0.27.2.tar.gz:

Publisher: publish.yml on scrapinghub/scrapy-poet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file scrapy_poet-0.27.2-py3-none-any.whl.

File metadata

  • Download URL: scrapy_poet-0.27.2-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for scrapy_poet-0.27.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be30313f1324c15b4291e91d93b6dece259df1f5b4a8f09e2983f4424e1f136d
MD5 0a0f0cfe1bded9d3c97a93ffa604dc90
BLAKE2b-256 9db9332502e17e344d9cefe1dd4c388ad7709548177f5fbc72cc23fe81e75485

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapy_poet-0.27.2-py3-none-any.whl:

Publisher: publish.yml on scrapinghub/scrapy-poet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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