mirror of https://github.com/scrapy/scrapy.git
bytes_received signal: send spider argument
This commit is contained in:
parent
89483ce9f7
commit
dbe20a863f
|
|
@ -162,7 +162,7 @@ bytes_received
|
|||
--------------
|
||||
|
||||
.. signal:: bytes_received
|
||||
.. function:: bytes_received(data, request)
|
||||
.. function:: bytes_received(data, request, spider)
|
||||
|
||||
Sent by the HTTP 1.1 download handler when a group of bytes is
|
||||
received for a specific request.
|
||||
|
|
@ -175,6 +175,9 @@ bytes_received
|
|||
:param request: the request that generated the response
|
||||
:type request: :class:`~scrapy.http.Request` object
|
||||
|
||||
:param spider: the spider associated with the response
|
||||
:type spider: :class:`~scrapy.spiders.Spider` object
|
||||
|
||||
spider_closed
|
||||
-------------
|
||||
|
||||
|
|
|
|||
|
|
@ -482,6 +482,7 @@ class _ResponseReader(protocol.Protocol):
|
|||
signal=signals.bytes_received,
|
||||
data=bodyBytes,
|
||||
request=self._request,
|
||||
spider=self._crawler.spider,
|
||||
)
|
||||
|
||||
if self._maxsize and self._bytes_received > self._maxsize:
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ class CrawlerRun(object):
|
|||
def item_scraped(self, item, spider, response):
|
||||
self.itemresp.append((item, response))
|
||||
|
||||
def bytes_received(self, data, request):
|
||||
def bytes_received(self, data, request, spider):
|
||||
self.bytes[request] += data
|
||||
|
||||
def request_scheduled(self, request, spider):
|
||||
|
|
|
|||
Loading…
Reference in New Issue