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.1.tar.gz (90.4 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.1-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scrapy_poet-0.27.1.tar.gz
Algorithm Hash digest
SHA256 fc561bc16c272f192abe6a477465536b16632a8d3e2121f5fafd15e5394325b3
MD5 ab2e4429436593a1a3fd6c5eff47fddf
BLAKE2b-256 ce408e6c9005a2d3b7504b9ee1e8f34e054385e14332b630c4cd3d61738e351c

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapy_poet-0.27.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: scrapy_poet-0.27.1-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.7

File hashes

Hashes for scrapy_poet-0.27.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2791cbda17c5d3d7992af05279ad44b838b56a9e2efff6603ebfaca146b3d280
MD5 9726e2f1071626831e6f6008d27abb46
BLAKE2b-256 594a02ce73850968be18e233bb6bfbdfcbbdb8d0c670dd9e02e7923f056f13e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for scrapy_poet-0.27.1-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