Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release notes
=============

1.25.1 (unreleased)
-------------------

- bug: Fix compatibility with Scrapy 2.14+ where ``process_item`` was
called without the ``spider`` argument (#473).

1.25.0 (2026-03-20)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion spidermon/contrib/scrapy/pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _load_jsonschema_validator(cls, schema):
)
return JSONSchemaValidator(schema)

def process_item(self, item, _):
def process_item(self, item, spider=None):
validators = self.find_validators(item)
if not validators:
# No validators match this specific item type
Expand Down
12 changes: 12 additions & 0 deletions tests/contrib/scrapy/test_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@ def test_validator_from_url(mocker):
assert stats.get("spidermon/validation/validators/testitem/jsonschema", False)


def test_process_item_without_spider_argument():
settings = {
"SPIDERMON_ENABLED": True,
SETTING_SCHEMAS: [test_schema],
}
test_item = TestItem({"url": "example.com"})
crawler = get_crawler(settings_dict=settings)
pipe = ItemValidationPipeline.from_crawler(crawler)
result = pipe.process_item(test_item)
assert result == test_item


class TestAddErrors:
def _run_pipeline(self, test_item):
settings = {
Expand Down
Loading