Skip to main content

Reusable Scrapy middleware for per-target item limits.

Project description

scrapy-itemlimit

Reusable Scrapy middleware for per-target item limiting during pagination crawls.

Installation

pip install scrapy-itemlimit

Included Middleware

PerTargetItemLimitSpiderMiddleware

Stops further item output for a target key after the configured limit is reached.

Supported settings:

  • PER_TARGET_ITEM_LIMIT (int)
  • TARGET_META_KEY (str, default: brand_token)

Scrapy Settings Example

SPIDER_MIDDLEWARES = {
	"scrapy_itemlimit.middlewares.PerTargetItemLimitSpiderMiddleware": 543,
}

PER_TARGET_ITEM_LIMIT = 100
TARGET_META_KEY = "brand_token"

Development Install

pip install -e .

Build and Publish to PyPI

  1. Bump version in both:
    • setup.py
    • scrapy_itemlimit/__init__.py
  2. Build package:
python -m pip install --upgrade build twine
python -m build
  1. Validate artifacts:
python -m twine check dist/*
  1. Upload:
python -m twine upload dist/*

Optional (recommended first): TestPyPI

python -m twine upload --repository testpypi dist/*

Version

Current package version: 0.2.0

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_itemlimit-0.2.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

scrapy_itemlimit-0.2.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file scrapy_itemlimit-0.2.0.tar.gz.

File metadata

  • Download URL: scrapy_itemlimit-0.2.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for scrapy_itemlimit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 71a39eb3e4e7ac89939f4945393e18b0c2c445b8ddad86885b272bd0ae1399e7
MD5 974e9d9de389075d7da7a1b56e6b77f3
BLAKE2b-256 a980111bbb975080ba0e63e8de63246e162524a6c72a6cb8cc7a1b3470c35328

See more details on using hashes here.

File details

Details for the file scrapy_itemlimit-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scrapy_itemlimit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46d5a5ffb352b4817b8ad473fd94fdecfbcbd113737a3bdd3ad3068cf11cf6d3
MD5 2accb2ada18e2377358db8fd29aacd59
BLAKE2b-256 cc864fd9bb13e586292e7e0c89cf031fe9e226dc23806c61b3d69a68073e3ac9

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