Skip to main content

scrapy-item-pipelines

Various scrapy item pipelines

Installation

pip install scrapy-item-pipelines

SaveToKafkaPipeline

Item pipeline to push items to kafka. Items will be converted into JSON format and pushed to a defined kafka topic.

Settings

SL_SCRAPY_ITEM_PIPELINES_SETTINGS = {
    "push_to_kafka_hosts": "localhost:9092"  # Kafka broker hosts. Separated with a comma.
    "push_to_kafka_default_topic": ""  # kafka default topic.
}

Usage

If items should be pushed to different kafka topics per item, the topic can be defined in the item class. Also if a data key should be pushed to kafka we can define the item field value to use by defining it in the item class. If no kafka_data_key is defined no data key will be pushed.

class DemoItem(scrapy.Item):
    kafka_topic = "topic-to-push-items"
    kafka_data_key = "another_unique_field"

    field_name = scrapy.Field()
    another_unique_field = scrapy.Field()

After configuring add scrapy_item_pipelines.streaming.PushToKafkaPipeline to the ITEM_PIPELINES setting.

ITEM_PIPELINES = {
    ...
    ...
    "scrapy_item_pipelines.streaming.PushToKafkaPipeline": 999,
}

FilterDuplicatesPipeline

Item pipeline to filter out duplicate items calculated using defined keys in the item.

Usage

Define an attribute called unique_key in the item. If the unique key is a single field unique_key can be defined as a string or if the unique key is a multi field key unique_key should be a tuple of strings. If no unique_key is defined filtering will be done using id field. If you want to skip duplicate filtering for an item define unique_key as None.

The pipeline will include a stats called duplicate_item_count which is the number of duplicate items dropped.

class DemoItem(scrapy.Item):
    field1 = scrapy.Field()
    field2 = scrapy.Field()

    unique_key = None  # duplicates won't be filtered.


class DemoItem(scrapy.Item):
    # No unique_key is defined. Filtering will be done using `id` field.
    field1 = scrapy.Field()
    field2 = scrapy.Field()
    id = scrapy.Field()


class DemoItem(scrapy.Item):
    field1 = scrapy.Field()
    field2 = scrapy.Field()

    unique_key = "field1"  # Duplicates will be filtered using field1.


class DemoItem(scrapy.Item):
    field1 = scrapy.Field()
    field2 = scrapy.Field()

    unique_key = ("field1", "field2")  # Duplicates will be filtered using both field1 and field2

Add scrapy_item_pipelines.misc.FilterDuplicatesPipeline to the ITEM_PIPELINES setting.

ITEM_PIPELINES = {
    ...
    ...
    "scrapy_item_pipelines.misc.FilterDuplicatesPipeline": 500,
}

Metadata

Release files for scrapy-item-pipelines 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapy-item-pipelines 0.2
File Size Uploaded Provenance Actions
scrapy-item-pipelines-0.2.tar.gz 5.3 kB Without provenance Details for scrapy-item-pipelines-0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-item-pipelines 0.2
File Interpreter ABI Platform Actions
scrapy_item_pipelines-0.2-py3-none-any.whl Python 3 none any Details for scrapy_item_pipelines-0.2-py3-none-any.whl

Total release size: 10.3 kB

Release files / scrapy-item-pipelines-0.2.tar.gz

Download URL scrapy-item-pipelines-0.2.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bdbcb1a64aa1190eab33da41f493f18dc289f7d37e7a2680c7659f9816fee0c9
BLAKE2b-256 checksum
How to use checksums
25ec99d8721a694949cc79cbb6fc69694be58b5d5832c2a46c4a9da504a8f4de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Release files / scrapy_item_pipelines-0.2-py3-none-any.whl

Download URL scrapy_item_pipelines-0.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72fb9d42e4bb83450aadc8d370e2c33a957543b0807db460ef65002122174dac
BLAKE2b-256 checksum
How to use checksums
d23a28f79377dc83ff367898d69645b19ee5c60f25452cc01b99435767f20c01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.25.1

Security for scrapy-item-pipelines 0.2

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.

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page