from scrapy.exceptions import DropItem class PriceValidationPipeline(object): def process_item(self, item, spider): # check if item price is less than 0 if item['price'] < 0: raise DropItem('Invalid item price found: %s' % item['price']) else: return itemIn this code example, the PriceValidationPipeline pipeline class checks if an item's price is less than zero, if so, it raises the DropItem exception to remove the item from the pipeline processing. Package library: scrapy.exceptions is part of the Scrapy package library.