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
- Bump version in both:
setup.pyscrapy_itemlimit/__init__.py
- Build package:
python -m pip install --upgrade build twine
python -m build
- Validate artifacts:
python -m twine check dist/*
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrapy_itemlimit-0.2.2.tar.gz.
File metadata
- Download URL: scrapy_itemlimit-0.2.2.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e0dd6554795d2ebed279172584dacf0c03ec89797f6b72f37a0d3c3c396ed79
|
|
| MD5 |
20b0a90bdd30ad066cf54744430cf926
|
|
| BLAKE2b-256 |
52bbeee35bafe84c0f4591ced77cf2e750c11df8a5e30ef91f671b3cb45303ba
|
File details
Details for the file scrapy_itemlimit-0.2.2-py3-none-any.whl.
File metadata
- Download URL: scrapy_itemlimit-0.2.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92cbc6d367197f09d9223943bfdcd34d3a95ad44af00233b76029a863075ab03
|
|
| MD5 |
f5fa267d084dcce2c325a4eaec0f1b4e
|
|
| BLAKE2b-256 |
0d685cd5f944097201e8f0d9d7bbe765636ecd48a57f663c1f1baea3429f11d1
|