scrapy-splitvariants
SplitVariantsMiddleware is a Scrapy spider middleware used to split single items into multiple items when they have a “variants” key with multiple values.
Example usage
Let’s assume your spider outputs an item with different size options (from an ecommerce website for example):
item = {"id": 12,
"name": "Big chair",
"variants": [{"size": "XL", "price": 200, "currency": "USD"},
{"size": "L", "price": 100, "currency": "USD"}]}
When you enable SplitVariantsMiddleware, this single item will become 2 items with the different variants values into a different item:
{"id": 12, "name": "Big chair", "size": "XL", "price": 200, "currency": "USD"}
{"id": 12, "name": "Big chair", "size": "L", "price": 100, "currency": "USD"}
Installation
Install scrapy-splitvariants using pip:
$ pip install scrapy-splitvariants
Configuration
Add SplitVariantsMiddleware by including it in SPIDER_MIDDLEWARES in your settings.py file:
SPIDER_MIDDLEWARES = { 'scrapy_splitvariants.SplitVariantsMiddleware': 100, }Here, priority 100 is just an example. Set its value depending on other middlewares you may have enabled already.
Enable the middleware using SPLITVARIANTS_ENABLED set to True in your setting.py.
Metadata
Release files for scrapy-splitvariants 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scrapy-splitvariants-1.1.0.tar.gz | 2.1 kB | Without provenance | Details for scrapy-splitvariants-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scrapy_splitvariants-1.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for scrapy_splitvariants-1.1.0-py2.py3-none-any.whl |
Total release size: 5.2 kB
Release files / scrapy-splitvariants-1.1.0.tar.gz
| Download URL | scrapy-splitvariants-1.1.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43f393f0380e59e0f8a80771102054f6a9660c5e8cb0f716c517c07b6e2bfdcd
|
|
BLAKE2b-256 checksum How to use checksums |
ec8c457f1f79de762e2afa8f8cfd163744edd3b586c17b7556eaef9586ffed5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / scrapy_splitvariants-1.1.0-py2.py3-none-any.whl
| Download URL | scrapy_splitvariants-1.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
da425cdaa03101406f076bd9600429d997ed395288e47bd4032e0a0b23d9f478
|
|
BLAKE2b-256 checksum How to use checksums |
33fdb5a0d2d0c8a4ba9636c09f6d47cc5d1ef56561a076c5f9aae89b6e5b68f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for scrapy-splitvariants 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.