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.

Read the documentation for more information.

License is BSD 3-clause.

Quick Start

Installation

pip install scrapy-poet

Requires Python 3.9+ and Scrapy >= 2.6.0.

Usage in a Scrapy Project

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

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

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.25.0.tar.gz (66.8 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.25.0-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scrapy_poet-0.25.0.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for scrapy_poet-0.25.0.tar.gz
Algorithm Hash digest
SHA256 52be64a1857b1b3287f693f7ffcb3c646c41fc9701f993d6fa998868fbc55cce
MD5 9e335f10c58f15474f64ee2d9034aa9b
BLAKE2b-256 3f92abcb176ee4ddf17af9379695abaeff2f60fdab0ca71dcdbafabb8c91afc5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scrapy_poet-0.25.0-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for scrapy_poet-0.25.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e266333d0acf260915fef1a7604566bd44e4e01f0e802073f9f914becb312150
MD5 740b60c98975330d82a386ad2b9dd323
BLAKE2b-256 2f07b16f129188b106dd853197a30c423ae282f5c147699717cb323568aaf2e6

See more details on using hashes here.

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