mirror of https://github.com/scrapy/scrapy.git
remove response from item_passed and item_dropped signal api
This commit is contained in:
parent
aba16c20c4
commit
eff8ea6173
|
|
@ -115,7 +115,7 @@ order.
|
||||||
:type response: :class:`~scrapy.http.Response` object
|
:type response: :class:`~scrapy.http.Response` object
|
||||||
|
|
||||||
.. signal:: item_passed
|
.. signal:: item_passed
|
||||||
.. function:: item_passed(item, spider, response, output)
|
.. function:: item_passed(item, spider, output)
|
||||||
|
|
||||||
Sent after an item has passed all the :ref:`topics-item-pipeline` stages without
|
Sent after an item has passed all the :ref:`topics-item-pipeline` stages without
|
||||||
being dropped.
|
being dropped.
|
||||||
|
|
@ -126,15 +126,12 @@ order.
|
||||||
:param spider: the spider which scraped the item
|
:param spider: the spider which scraped the item
|
||||||
:type spider: :class:`~scrapy.spider.BaseSpider` object
|
:type spider: :class:`~scrapy.spider.BaseSpider` object
|
||||||
|
|
||||||
:param response: the response from which the item was scraped
|
|
||||||
:type response: :class:`~scrapy.http.Response` object
|
|
||||||
|
|
||||||
:param output: the output of the item pipeline. This is typically the
|
:param output: the output of the item pipeline. This is typically the
|
||||||
same :class:`~scrapy.item.ScrapedItem` object received in the ``item``
|
same :class:`~scrapy.item.ScrapedItem` object received in the ``item``
|
||||||
parameter, unless some pipeline stage created a new item.
|
parameter, unless some pipeline stage created a new item.
|
||||||
|
|
||||||
.. signal:: item_dropped
|
.. signal:: item_dropped
|
||||||
.. function:: item_dropped(item, spider, response, exception)
|
.. function:: item_dropped(item, spider, exception)
|
||||||
|
|
||||||
Sent after an item has been dropped from the :ref:`topics-item-pipeline`
|
Sent after an item has been dropped from the :ref:`topics-item-pipeline`
|
||||||
when some stage raised a :exception:`DropItem` exception.
|
when some stage raised a :exception:`DropItem` exception.
|
||||||
|
|
@ -145,9 +142,6 @@ order.
|
||||||
:param spider: the spider which scraped the item
|
:param spider: the spider which scraped the item
|
||||||
:type spider: :class:`~scrapy.spider.BaseSpider` object
|
:type spider: :class:`~scrapy.spider.BaseSpider` object
|
||||||
|
|
||||||
:param response: the response from which the item was scraped
|
|
||||||
:type response: :class:`~scrapy.http.Response` object
|
|
||||||
|
|
||||||
:param exception: the exception (which must be a :exception:`DropItem`
|
:param exception: the exception (which must be a :exception:`DropItem`
|
||||||
subclass) which caused the item to be dropped
|
subclass) which caused the item to be dropped
|
||||||
:type exception: :exception:`DropItem` exception
|
:type exception: :exception:`DropItem` exception
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ class Scraper(object):
|
||||||
item=output, spider=spider, response=response)
|
item=output, spider=spider, response=response)
|
||||||
self.sites[domain].itemproc_size += 1
|
self.sites[domain].itemproc_size += 1
|
||||||
dfd = self.itemproc.process_item(output, spider)
|
dfd = self.itemproc.process_item(output, spider)
|
||||||
dfd.addBoth(self._itemproc_finished, output, response, spider)
|
dfd.addBoth(self._itemproc_finished, output, spider)
|
||||||
return dfd
|
return dfd
|
||||||
elif output is None:
|
elif output is None:
|
||||||
pass
|
pass
|
||||||
|
|
@ -179,7 +179,7 @@ class Scraper(object):
|
||||||
else:
|
else:
|
||||||
return spider_failure # exceptions raised in the spider code
|
return spider_failure # exceptions raised in the spider code
|
||||||
|
|
||||||
def _itemproc_finished(self, output, item, response, spider):
|
def _itemproc_finished(self, output, item, spider):
|
||||||
"""ItemProcessor finished for the given ``item`` and returned ``output``
|
"""ItemProcessor finished for the given ``item`` and returned ``output``
|
||||||
"""
|
"""
|
||||||
domain = spider.domain_name
|
domain = spider.domain_name
|
||||||
|
|
@ -189,11 +189,11 @@ class Scraper(object):
|
||||||
if isinstance(ex, DropItem):
|
if isinstance(ex, DropItem):
|
||||||
log.msg("Dropped %s - %s" % (item, str(ex)), log.DEBUG, domain=domain)
|
log.msg("Dropped %s - %s" % (item, str(ex)), log.DEBUG, domain=domain)
|
||||||
signals.send_catch_log(signal=signals.item_dropped, sender=self.__class__, \
|
signals.send_catch_log(signal=signals.item_dropped, sender=self.__class__, \
|
||||||
item=item, spider=spider, response=response, exception=output.value)
|
item=item, spider=spider, exception=output.value)
|
||||||
else:
|
else:
|
||||||
log.msg('Error processing %s - %s' % (item, output), \
|
log.msg('Error processing %s - %s' % (item, output), \
|
||||||
log.ERROR, domain=domain)
|
log.ERROR, domain=domain)
|
||||||
else:
|
else:
|
||||||
signals.send_catch_log(signal=signals.item_passed, sender=self.__class__, \
|
signals.send_catch_log(signal=signals.item_passed, sender=self.__class__, \
|
||||||
item=item, spider=spider, response=response, output=output)
|
item=item, spider=spider, output=output)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue